Podcast
Questions and Answers
Define Mutual Exclusion
Define Mutual Exclusion
A region of code may only be executed by one single thread at a time.
Define Producer-Consumer
Define Producer-Consumer
One thread produces something that another thread needs to use/consume. we can just use a flag to indicate to another thread that an event has occurred, and we don't necessarily need hardware support for that.
Define Barrier
Define Barrier
All threads must finish before moving past this point.
Explain why the following lock implementation is faulty.
Thread 0 Thread 1
time 0: lock: ld R1, &lockvar.
time 1: bnz R1, lock. lock: ld R1, &lockvar
time 2: sti &lockvar, #1 bnz R1, lock
time 3: sti &lockvar, #1
Explain why the following lock implementation is faulty.
Thread 0 Thread 1
time 0: lock: ld R1, &lockvar.
time 1: bnz R1, lock. lock: ld R1, &lockvar
time 2: sti &lockvar, #1 bnz R1, lock
time 3: sti &lockvar, #1
Explain how a test-and-set instruction works.
Explain how a test-and-set instruction works.
Write code to implement a mutual exclusion lock using a test-and-set instruction:
Write code to implement a mutual exclusion lock using a test-and-set instruction:
What are the four metrics used in evaluating lock implementations?
What are the four metrics used in evaluating lock implementations?
Fill out the following table for the Test-and-Set lock:
as time goes on (Init, t&s1, t&s2, t&s3, t&s2, unlock1, t&s2, t&s3, t&s3, unlock2, t&s3, unlock3)
Include answer as an array of values <P1, P2, P3, Bus Request>
So the init would be < -, -, -, - > and
Fill out the following table for the Test-and-Set lock: as time goes on (Init, t&s1, t&s2, t&s3, t&s2, unlock1, t&s2, t&s3, t&s3, unlock2, t&s3, unlock3) Include answer as an array of values <P1, P2, P3, Bus Request> So the init would be < -, -, -, - > and
Explain the Test and Test and Set Lock implementation. Explain why TTSL reduces traffic but increases uncontended lock acquisition latency.
Explain the Test and Test and Set Lock implementation. Explain why TTSL reduces traffic but increases uncontended lock acquisition latency.
Write an implementation of a TTSL mutual exclusion lock:
Write an implementation of a TTSL mutual exclusion lock:
Fill out the following table for the TTSL:
as time goes on (Init, ld1, t&s1, ld2, ld3, ld2, unlock1, ld2, t&s2, ld3, ld3, unlock2, ld3, t&s3, unlock3)
Include answer as an array of values <P1, P2, P3, Bus Request>
So the init would be < -, -, -, - > and
Fill out the following table for the TTSL: as time goes on (Init, ld1, t&s1, ld2, ld3, ld2, unlock1, ld2, t&s2, ld3, ld3, unlock2, ld3, t&s3, unlock3) Include answer as an array of values <P1, P2, P3, Bus Request> So the init would be < -, -, -, - > and
What metric does a Ticket Lock and Array based lock improve on over other lock implementations?
What metric does a Ticket Lock and Array based lock improve on over other lock implementations?
Write code to implement ticket lock, and array based queue lock?
Write code to implement ticket lock, and array based queue lock?
Describe LL/SC.
Describe LL/SC.
Fill out the following table for LL/SC:
as time goes on (Init,ll1, sc1, ll2, ll3, ll2, unlock1, ll2, sc2, ll3, ll3, unlock2, ll3, sc3, unlock3)
Include answer as an array of values <P1, P2, P3, Bus Request>
So the init would be < -, -, -, - > and
Fill out the following table for LL/SC: as time goes on (Init,ll1, sc1, ll2, ll3, ll2, unlock1, ll2, sc2, ll3, ll3, unlock2, ll3, sc3, unlock3) Include answer as an array of values <P1, P2, P3, Bus Request> So the init would be < -, -, -, - > and
Do Problem 2 in HW2. True if you get answers correct, false otherwise.
Do Problem 2 in HW2. True if you get answers correct, false otherwise.
Flashcards
Mutual Exclusion
Mutual Exclusion
A region of code can only be executed by one thread at a time.
Producer-Consumer
Producer-Consumer
One thread produces data that another thread consumes.
Barrier
Barrier
All threads must wait to reach a specific point until all threads have finished an action.
Faulty Lock Implementation
Faulty Lock Implementation
Signup and view all the flashcards