Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/wrs120/article/details/90717059
synchronized
- Keywords, based jvm
- Locks are released: @ 1: to acquire a lock thread executes the code block @ 2 over thread execution appear abnormal, is a passive way to release, () released by Monitor.exit, Monitor more explanation see:. HTTPS: // Blog. csdn.net/ignorewho/article/details/80854625
- It is a reentrant lock, interruptible lock,
- Suitable for less concurrency
Lock
- Interface, based on java programming
- Call Lock.unlock () to release the lock, is an active way to release
- Divided into: ReentrantLock read-write locks, ReadWriteLock reentrant lock, lock fair, interruptible lock
- Higher than the synchronized performance at high concurrency