Chapter 3 Flashcards

1
Q

In OO programming what is an object

A

container for Data

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

What is an example of a state (set of fields)

A

a sequence of items in a Queue

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

What is an example of methods

A

enq + deq

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

What is the safety + liveness properties of an object

A

Safety: nothing bad happens (correctness). Liveness: something good eventually happens (progress)

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

How to determine if an object’s are behaving correctly?

A

Pre/post conditions

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

Can concurrent methods overlap?

A

Yes

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

Should you characterize all possible interactions with concurrent calls?

A

Yes

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

Principle 3.3.1

A

Method calls should appear to happen in a one-at-a-time sequential order

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

When is a object quiescenct

A

when it has no method calls (inactive)

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

Principle 3.3.2

A

Methods calls separated by a period of quiescence should appear to take effect in real-time order(if methods call is separated by gap of inactivity…)

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

What does 3.3.1 and 3.3.2 form

A

Quiescent consistency

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

When is a object quiescent consistent

A

If method calls appear to be in sequential order, method calls take place in real-time order if separated by period of inactivity

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

Is Quiescent consistency compositional?

A

Yes. If Each object in the system the whole system will be quiescent consistent

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

Principle 3.4.1

A

Method calls should take effect in program order(order in which a single thread issues method calls)

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

Is method calls by different calls unrelated by program order?

A

Yes

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

What does 3.3.1 and 3.4.1 form

A

Sequential consistency

17
Q

When is a object in sequential order?

A

method calls are in sequential + program order

18
Q

A.enq(x) concurrent with B.enq(Y), then A.deq(y) concurrent with B.deq(x). Construct 2 possible sequential orders

A

A.enq(x)->B.enq(y)->B.deq(x)->A.deq(y)

B.enq(y)->A.enq(x)->A.deq(y)->B.deq(x) (both are in program order)

19
Q

Is quiescent and sequential consistancy comparable?

A

no. 1 does not mean the other exists

20
Q

Principle 3.5.1(Linearizability

A

Each method call should appear to take effect instantly at some moment between invocation and response

21
Q

What is the linearization point?

A

CS/ single step where the effects of the method call become visible to other methods

22
Q

3 correctness conditions

A

Quiescent consistency
Sequential consistency
Linearizability

23
Q

When is a method lock free

A

if some method calls finishes in a finite number of steps

24
Q

When is a method wait free

A

if it guarantees that every call finishes its execution in a finite number of steps

25
Q

Progress Conditions

A

Deadlock-free: some thread trying to acquire the lock eventually succeeds.
Starvation-free: every thread trying to acquire the lock eventually succeeds.
Lock-free: some thread calling a method eventually returns (succeeds)
Wait-free: every thread calling a method eventually returns (succeeds)

26
Q

does synchronization usually imply mutual exclusion?

A

yes

27
Q

Are synchronization events linearizable?

A

yes. ordered + all threads agree on ordering

28
Q

What are sync events

A

Locks + sync blocks
Volatile fields
Final fields