Section 1. Exercises in Lab 3
There are three exercises in this lab. The purpose of this lab is to learn about thread synchronization in Unix-based OS. Due to the difficulty of debugging concurrent programs, the complexity of this lab has been adjusted accordingly. Hence, you should find the required amount of coding "minimal". General outline of the exercises:
• Exercise 1: Basic readers-writers problem
• Exercise 2: A more fair readers-writers problem
• Exercise 3: Synchronization in a roundabout
2.1 Exercise 1 In exercise 1,
we will implement the readers-writers lock (RW-Lock) needed to fulfil the basic requirements of the readers-writers problem. Recall that in this problem, there are two kinds of threads – reader threads and writer threads. Each thread is trying to read from or write to a shared resource respectively. The requirements of this problem are:
1. A writer cannot write to the shared resource when anyone else (reader or writer) is using the resource.
2. Readers cannot read from the shared resource when a writer is writing to it.
However, multiple readers can read the shared resource simultaneously.
Get Free Quote!
390 Experts Online