Parallel Exam 3

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/26

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 12:15 AM on 3/18/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

27 Terms

1
New cards

What is the primary problem with locks?

Something might happen to the thread holding the lock.

2
New cards

What does it mean for an operation to be atomic?

No in between states can be seen.

3
New cards

What does it mean for an atomic operation to be lock-free?

The atomic operation is supported directly by the hardware.

4
New cards

Atomic types

  • atomic_flag

  • atomic

5
New cards

atomic_flag

The only atomic type guaranteed to be lock-free

6
New cards

What are the two methods of an atomic_flag?

  • .clear()

  • .test_and_set()

7
New cards

What does .test_and_set() do to an atomic_flag?

It sets the flag and returns the previous value.

  • If the value was 0, it sets the flag to 1 but returns 0.

  • If the value was 1, it does not reset the flag but returns 1.

8
New cards

What does .clear() do to an atomic_flag?

It clears the bit of the atomic_flag

9
New cards

Explain i.compare_exchange_weak(e,v)/i.compare_exchange_strong(e,v).

If (e == current value of i){

	i = v;

}

else{

	e = i;

}

10
New cards

What is the difference between i.compare_exchange_weak(e,v) and i.compare_exchange_strong(e,v)?

Weak is allowed to fail even when the value matched (spurious failure). Strong is required to succeed when the values match.

11
New cards

What does correctness require?

  • Safety

  • Liveness

12
New cards

What is safety?

Bad things never happen.

13
New cards

What is liveness?

Good things will eventually happen.

14
New cards

Safety is defined in terms of __________.

Safety is defined in terms of linearizability.

15
New cards

What does it mean for the execution of a parallel algorithm to be linearizable?

The execution is equivalent to some sequential execution history.

16
New cards

When is a data structure implementation linearizable?

When every possible history obtainable with that object is linearizable.

17
New cards

What are the requirements for an algorithm to be linearizable?

Each operation must appear to happen instantaneously at some point between its call and its return.

18
New cards

What is the linearization point?

The point between when no effect of an operation is visible and all of the effects of an operation are visible.

19
New cards

How can we prove the safety of an algorithm?

Identify the linearization point.

20
New cards

The linearization point is always an _______ instruction.

The linearization point is always an atomic instruction.

21
New cards

What are the different definitions of liveness?

  • Obstruction-free:

    • every thread is guaranteed to complete even if all other threads were suddenly suspended

    • Not possible with mutexes; if a thread suspends while holding the mutex then I am stuck

    • Cannot be dead-locked

  • Lock-free: some thread is guaranteed to complete in a fixed number of steps

    • Guaranteed to make progress

    • Cannot be live-locked

  • Wait-free: every thread is guaranteed to complete in a fixed number of steps

    • No other thread can get in my way

    • Cannot suffer starvation

    • Very hard to obtain, and often unnecessary

22
New cards

When is it desirable to have wait-free liveness?

real-time systems that need a guarantee that the algorithm will complete in a fixed amount of time.

23
New cards

What is non-blocking? and does it guarantee any of the definitions of liveness?

  • the absence of mutexes

  • it does not guarantee any of the definitions of liveness

24
New cards

What is the ABA problem?

  • You have A --> M --> N

  • t1 wants to pop off A, but t2 makes it to the stack before t1 and pops off A and adds B, resulting in B --> M --> N

  • t3 comes and creates a new node; the memory management system gives t3 the memory of discarded node A, resulting in A(with new data) --> B --> M --> N

  • t1 finally gets a turn at accessing the stack. The problem is that t1’s oldHead variable in the pop() method has M as the next node, not B; so, A is popped off, head is assigned oldHead->next, which is M, and node B is forgotten.

25
New cards

Sequentially consistent ordering

All of the threads see the operations in the same order. They all agree on some ordering of operations. All processors agree on the order that operations occur, regardless of whether they appeared in the order that we wanted them to occur. When stuff happens ALL of the threads will agree

26
New cards

Relaxed

Each thread sees changes to variables at different times.

27
New cards

Release-Acquire

When thread1 releases memory, the thread that acquires the atomic will also see all of the changes that thread1 made to non-atomic variables.

Explore top notes

note
envirochem test prep - soils
Updated 1059d ago
0.0(0)
note
Chapter 10: Factor Markets
Updated 1059d ago
0.0(0)
note
Roman Mythology and Society
Updated 1059d ago
0.0(0)
note
Periodic Table
Updated 237d ago
0.0(0)
note
Prokaryotic Cells
Updated 1184d ago
0.0(0)
note
envirochem test prep - soils
Updated 1059d ago
0.0(0)
note
Chapter 10: Factor Markets
Updated 1059d ago
0.0(0)
note
Roman Mythology and Society
Updated 1059d ago
0.0(0)
note
Periodic Table
Updated 237d ago
0.0(0)
note
Prokaryotic Cells
Updated 1184d ago
0.0(0)

Explore top flashcards

flashcards
Avancemos 4.2
55
Updated 868d ago
0.0(0)
flashcards
YR 11 KO Healthy Lifestyle
49
Updated 217d ago
0.0(0)
flashcards
Ch 15 Evolution
34
Updated 341d ago
0.0(0)
flashcards
PHR 515 Exam 1
65
Updated 533d ago
0.0(0)
flashcards
Histology of bone
26
Updated 1252d ago
0.0(0)
flashcards
Pendleton Circulatory Stuff
86
Updated 1215d ago
0.0(0)
flashcards
Unit 5 Vocab part 2
26
Updated 509d ago
0.0(0)
flashcards
Avancemos 4.2
55
Updated 868d ago
0.0(0)
flashcards
YR 11 KO Healthy Lifestyle
49
Updated 217d ago
0.0(0)
flashcards
Ch 15 Evolution
34
Updated 341d ago
0.0(0)
flashcards
PHR 515 Exam 1
65
Updated 533d ago
0.0(0)
flashcards
Histology of bone
26
Updated 1252d ago
0.0(0)
flashcards
Pendleton Circulatory Stuff
86
Updated 1215d ago
0.0(0)
flashcards
Unit 5 Vocab part 2
26
Updated 509d ago
0.0(0)