11 - More Synchronization Mechanisms Flashcards

1
Q

What is a Monitor?

A

A programming language construct that controls access to shared data

A module that encapsulates
• shared data structures
• and methods that operate on these shared data structures
• synchronization is done between concurrent method invocations

A monitor is a higher-level construct compared to mutexes and semaphores

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are some advantages of using Monitors over Semaphores or Mutexes?

A

• programming with monitors → you test/debug the monitor
• programming with mutexes/semaphores → you test/debug all
code using them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a Spinlock?

A

Lightweight alternative to a mutex

Implemented using busy waiting loops

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why would one want to use a spinlock?

A

Wery efficient if you know the wait time will
be very short
• because no re-scheduling required
• only make sense on multi-core/CPU systems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly