monitor |
Monitor consists of private data with public functions that can access such data. Method-method in a monitor has been designed in such a way so that there is only one method that can work at any one time. This aims to ensure that all monitors are operating in mutual exclusion.
Monitor can be analogue as a building with three rooms: one fruit of the control room, one-room wait-entry, single-room-in waiting. When a thread enters the monitor, he entered the room-wait-go (enter). When his turn came, thread into the control room (acquire), here thread to finish the job with a shared resource in the control room (Owning). If the task thread is not finished but the allotted time has run out for him or thread is waiting for another thread finish the job, thread to release control of the monitors (release) and transferred to room-in-waiting (waiting queue).When his turn came again, thread into the control room again (acquire). If the job is finished, he stepped out of the monitor (release and exit).
Comments :
Posting Komentar