Monitors

Class where only one procedure runs at a time

Possibly less error prone than Mutex, but also less flexible

monitor monitor-name {
	// Shared varaible declarations

	procedure P1(...) {...}
	...
	procedure Pn(...) {...}

	Initialization code(...) {...}
}
Implementation

Pasted image 20231207222052.png

  • Queue of threads waiting to get in
  • Queues insides are associated with conditions
    • implements CV