Chapter 2 Flashcards

1
Q

What is a thread

A

a sequence of events

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

what is a interval? A0 = (a0,a1)?

A

Time between a0 and a1

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

Notation for precedence

A

A0->B0

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

What is a critical section?

A

block of code that can only be executed by 1 thread at a time

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

Properties of a good Lock algorithm?

A

Mutual Exclusion, Deadlock-free, Starvation-free

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

What does deadlock-free mean?

A

If threads attempt to acquire the lock, at least 1 will succeed

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

What does Starvation-free mean

A

every thread that attempts to acquire the lock will eventually succeed

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

Basic idea of LockOne

A

set flag, check to see if other is in CS, (if yes wait, if no enter CS)

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

Problem with LockOne

A

Can lead to deadlock

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

Basic idea of LockTwo

A

Set self as victim, while current thread is victim wait until other thread becomes victim

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

Problem with LockTwo

A

If only 1 thread runs it will stay victim forever -> never runs

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

Peterson lock basic idea

A

Combine lock 1 and 2

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

how many waiting rooms are there in a Filter Lock

A

n-1

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

In the filter lock, is the CS closer to the top (higher level) or bottom

A

Top

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

Is the Filter Lock fair?

A

No. Threads can be overtaken

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

Idea of Bakery Algorithm

A

Give threads a label, Let lower labels run 1st

17
Q

Problem using labels + solution for Bakery

A

If normal labels: infinite numbers needed. Solution: Sequential Timestamps