Synchronization mechanisms Flashcards

1
Q

what is the critical section problem

A

each process has a critical section that is mutually exclusive - if one process is in its critical section, no other process may be in its critical section

how to design a protocol to solve this

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

Name the three requirements for solutions to critical section problem

A

mutual exclusion
progress
bounded waiting

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

what is meant by mutual exclusion

A

if process a is in its critical section, no other process can be in its critical section

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

what is meant by progress (requirement for solution to crit section problem)

A

any process wanting to enter its critical section should be allowed to compete to enter and we should be able to make the decision in a reasonable amount of time

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

what is meant by bounded waiting

A

there exists a limit on the number of times that other processses are allowed to enter their critical sections after a process has made a request to enter its critical section

basically if a process requests to enter its crit section, there should be a limit to the number of other processes that will exectute their crit sections before it - i.e. should be granted access to its critical section in a reasonable amount of time

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

Name and explain some hardware solutions to synchronization

A

test-and-set() - combines the actions of testing and setting a variable into a single machine instruction that cannot be interrupted
compare-and-swap() - swaps the value of a variable only if equal to the expected value

do not satisfy bounded waiting

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

Name some software solutions

A

mutex lock

semaphores

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

Different types of semaphores

A

binary

counting

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

what are monitors

A
high level abstraction that provides a convenient and effective mechanism for process synchronization
- class in which all data is private and onlt one method within any given monitor is active at a time

monitor methods may only access the shared data within the monitor and nay data passed to them as parameters.. i.e. they cannot access any data external to the monitor

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

what are condition variables

A

condition x;
x.wait() - suspend process until x.signal() is called

there is not much detail about this?

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

Signaling pattern with semaphores

A

See physical notes

A1 before B1

Thread A
a1()
sem.signal()

Thread B
sem.wait()
b1

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

Rendezvous pattern

A

See physical notes

a1 before b2 and b1 before a2

Thread a

a1()
aSem.signal()
bSem.wait()
a2()

Thread b

b1()
bSem.signal()
aSem.wait()
b2()

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

Barriers

A

Lecture video - physical notes

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