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
Signup and view all the answers
Explain how a test-and-set instruction works.
Explain how a test-and-set instruction works.
Signup and view all the answers
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:
Signup and view all the answers
What are the four metrics used in evaluating lock implementations?
What are the four metrics used in evaluating lock implementations?
Signup and view all the answers
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
Signup and view all the answers
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.
Signup and view all the answers
Write an implementation of a TTSL mutual exclusion lock:
Write an implementation of a TTSL mutual exclusion lock:
Signup and view all the answers
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
Signup and view all the answers
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?
Signup and view all the answers
Write code to implement ticket lock, and array based queue lock?
Write code to implement ticket lock, and array based queue lock?
Signup and view all the answers
Describe LL/SC.
Describe LL/SC.
Signup and view all the answers
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
Signup and view all the answers
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.
Signup and view all the answers