Ch 5 p 227 Flashcards

1
Q

critical section problem

A

MUST ALLOW EXCLUSIVE ACCESS TO ONE PROCESS

when processes share a lot of variables it serialized the code.

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

Peterson’s solution

A

int turn; // ready condition
boolean flag[2]; // if process is ready to enter critical seciotn

problem with this solution is that you can only use 1 type of thread

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

use of locks (low level solution)

A

solution to peterson’s problem

test_and_set // one lock for implementaion
initialize lock to false
if true, set lock to true
if false, set to true (locks processes out)

compare_and_swap // each process has its own lock (new bool value) plus a shared lock (expected)
initialize lock to false
swap if new and expected bool value equal

problem with locks is busy waiting.
solution is sleepy threads ( wait( ) )

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

Mutex locks (high level solution) (spinlock)

A

acquire() and release() must be atomic

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

Deadlock

A

when two or more processes are waiting indefinitely for an event that can be cause only by one of the waiting processes

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

race condition

A

situation where several processes access and manipulate the same data concurrently and the outcome of the execution depends on the particular order in which the access takes place.

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

priority inverison

A

inverting priority when starvation, or indefinite deadlocks, occur

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

binary semaphore is basically a mutex lock

A

binary semaphore is basically a mutex lock

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

critical-section solution requirements

A
mutual exclusion - only one process can execute its critical section
progress - selection can't be postponed indefinitely – no deadlock
bounded waiting (fairness) -  a process requesting to enter its critical section only waits certain time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly