In Java, using the synchronized keyword specifies a monitor construct. By doing so, the compiler automatically inserts code to control concurrent accesses to an object. It is traditionally implemented using a mutex and a condition variable (to avoid busy waiting like in assignment 4)
eosofsky
To further explain @kapalani's comment, using a mutex and a condition variable could avoid busy waiting because instead of spinning until the thread is given the lock, the thread can be descheduled and only rescheduled when the lock is available (provided that this is how the condition variable is implemented).
In Java, using the synchronized keyword specifies a monitor construct. By doing so, the compiler automatically inserts code to control concurrent accesses to an object. It is traditionally implemented using a mutex and a condition variable (to avoid busy waiting like in assignment 4)
To further explain @kapalani's comment, using a mutex and a condition variable could avoid busy waiting because instead of spinning until the thread is given the lock, the thread can be descheduled and only rescheduled when the lock is available (provided that this is how the condition variable is implemented).