Explain role of monitor to achieve mutual exclusion.

This answer is restricted. Please login to view the answer of this question.

Login Now

Mutual Exclusion using Monitors

Some programming languages, such as Concurrent Pascal, Modula-2 and Java provide mutual exclusion facilities called monitors.

They are similar to modules in languages that provide abstract data types in that:

 

  • programmer defines a set of data types and procedures that can manipulate the data. 
  • procedures can be exported to other modules, which may import them. 
  • system invokes initialization routine before execution begins.

Monitors differ in that they support guard procedures. Java programmers can use the keyword synchronized to indicate methods of a class where only one method can execute at a time.

Guard procedures (synchronized methods) have the property that:

 

  • only one process can execute a guard procedure at a time. 
  • When a process invokes a guard procedure, its execution is delayed until no other processes are executing a guard procedure (important)
If you found any type of error on the answer then please mention on the comment or report an answer or submit your new answer.
Leave your Answer:

Click here to submit your answer.

Discussion
0 Comments
  Loading . . .