Handouts

Handouts reflect problems we have solved together in class.

Here are some links to handouts that you may have received in class.

Shared counter problem with no locks

Sample trace illustrating the need for mutual exclusion

Shared counter problem with non-working SpinLock

Shared counter problem with working SpinLock using test-and-set

Basic linked-list implementation: what happens if multiple threads insert?

Ticket lock using the fetch-and-add primitive

A queued lock using park() and unpark()

Using condition variables to solve the join problem

Producer-consumer problem

Semaphore definition

Using a semaphore as a lock

Using a semaphore as a condition variable

Implementation of a semaphore

Readers-writer lock