Concurrency Control Flashcards

1
Q

what is the bounded-buffer problem (producer-consumer)

A

a process produces data, another consumes it, and their rates may vary. they share a buffer. to solve this we synchronise when the buffer is empty or full

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

what is a race condition?

A

a situation in which two processes or threads are trying to acquire the same resource, and the order of access is relevant

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

what is a critical section?

A

a process is in a critical section when it is accessing shared data. we need to ensure that only one process can be executing in a critical section at a given time, to avoid race conditions. the entry and exit from the section must be atomic

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

what is a spin lock/busy wait?

A

a while loop that loops while the lock is on, and then breaks when the lock is unlocked

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

what are the semaphore operations?

A

wait
delays until the sem is > 0 then decrements it
and signal
increments the sem

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

what is a monitor?

A

a high level tool that provides syncronised operations
a process takes a monitor and then other processes cant run with that monitor
contains a queue of suspended processes
can contain condition variables that support variable-level exclusivity, x.wait() e.g.

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

what are the conditions for a deadlock?

A
  • mutual exclusion (at least 1 resource is not shareable)
  • hold and wait (process holds a resource and is waiting for another)
  • no resource preemption
  • circular wait (processes are waiting in a loop)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what are some deadlock strategies?

A

prevention - make sure they’re impossible. processes can declare their maximum needs and we can schedule accordingly.
recovery - detect it and correct it
ignore it - most common

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