Chapter 2 Flashcards
What is a thread
a sequence of events
what is a interval? A0 = (a0,a1)?
Time between a0 and a1
Notation for precedence
A0->B0
What is a critical section?
block of code that can only be executed by 1 thread at a time
Properties of a good Lock algorithm?
Mutual Exclusion, Deadlock-free, Starvation-free
What does deadlock-free mean?
If threads attempt to acquire the lock, at least 1 will succeed
What does Starvation-free mean
every thread that attempts to acquire the lock will eventually succeed
Basic idea of LockOne
set flag, check to see if other is in CS, (if yes wait, if no enter CS)
Problem with LockOne
Can lead to deadlock
Basic idea of LockTwo
Set self as victim, while current thread is victim wait until other thread becomes victim
Problem with LockTwo
If only 1 thread runs it will stay victim forever -> never runs
Peterson lock basic idea
Combine lock 1 and 2
how many waiting rooms are there in a Filter Lock
n-1
In the filter lock, is the CS closer to the top (higher level) or bottom
Top
Is the Filter Lock fair?
No. Threads can be overtaken