
Week 14
Authored by Andreas Ellison
Computers
University
Used 16+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
9 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
1 min • 1 pt
Mark one ADVANTAGE and one DISADVANTAGE of STM (Software Transactional Memory, as opposed to Hardware Transactional Memory)
worse performance
better performance
can be used flexibly, without support from the hardware
more work for the programmer
2.
MULTIPLE SELECT QUESTION
2 mins • 1 pt
What does the programmer have to pay attention to when using shared mutable state with reference-based STMs (e.g. scala-stm)?
variables must be volatile
special reference variables/objects must be used for the shared state
the program should not directly modify the shared state by itself
the programmer must remember to add accesses to the read/write set
when using `retry`, one must specify all variables for which updates should be detected
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Atomic registers can be used to implement CAS
True
False
Answer explanation
We know from the lecture that atomic registers have consensus number 1. If we could implement CAS with atomic registers, we then could use that to solve 2-thread (or n-thread) consensus, a contradiction.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
The following code is a correct consensus protocol for 2 threads
True
False
Answer explanation
An execution is possible where both threads read i == -1 one after the other. Then they both return their own inputs, which may differ.
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
True
False
Answer explanation
False, the implementation is blocking. If a thread stops executing while holding the lock, the other thread can execute infinitely many steps without finishing, contradicting wait-freedom.
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
True
False
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
True
False
Answer explanation
The construction of a consensus protocol for 2 threads using a queue was shown in the lecture (or see page 107 of the book). What should be surprising is that this is a correct protocol even if the queue is only lock-free. It turns out that any lock-free consensus protocol is also wait-free. Since there is a finite number of threads and a single consensus call from each thread, we can argue that any single call will be wait-free: while the call by a thread A is pending, a call by some thread is guaranteed to finish in a finite number of steps by lock-freedom. After this finite number of steps, we can again apply lock-freedom and know that some other call will finish in a finite number of steps. At the latest, the call on thread A will finish after all other threads have completed their calls.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
QUIZ GAME
Quiz
•
University
12 questions
QUIZ SAD TOPIC 1_Introduction to Information System (SAD)
Quiz
•
University
11 questions
Youtube
Quiz
•
4th Grade - University
10 questions
computer Networks
Quiz
•
University
10 questions
Industry 4.0 Unit 1
Quiz
•
University
10 questions
Scratch
Quiz
•
KG - Professional Dev...
9 questions
Structured/Traditional SDM
Quiz
•
University
11 questions
Tutorium 1 - Prog2
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
54 questions
Analyzing Line Graphs & Tables
Quiz
•
4th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade