Classical synchronization problems Flashcards

1
Q

Producer threads

A

create items of some kind and add them to DS

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

consumer threads

A

remove and process items

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

Example of producer consumer relationships

A

event driven programs

  • when event occurs, the prod thread creates an event object and adds it to the event buffer
  • consumer threads take events out of buffer and process them - concurrently
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the producer consumer problem?

A

while being added or removed the buffer is in an inconsistent state. threads therefore need to have exclusive access to buffer
- consumer arrives while buffer is empty, it needs to block until a producer adds a new item

  • bounded buffer variant, producer cannot produce if buffer is full
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Synchronization constraints for readers-writers problem

A

any number of readers can be in the critical section simultaneously
writers need exclusive access to their critical section

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

Two types (variations) of how readers and writers are considered

A
  1. no reader is kept waiting unless writer has permission to use shared object - prioritizes readers
  2. once reader is ready it performs the write ASAP
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Liveness

A

processes must make progress and not wait indefinitely

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

Starvation

A

indefinite blocking e.g. process never removed from semaphore queue

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

Deadlock

A

two or more processes are waiting infinitely long for an event that can never occur

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