COMPSCI 3SH3 Fall, 2023
November 2, 2023
Lab report due date: Nov. 19th 2023, 11:59:59 pm
Lab 4: Practice and Assignment - Synchronization
The implementation has to be completed during lab time.
You can present your assignment to TA in any of four lab sessions.
a) Show your solution to TA and run it on Linux VM
b) Answer all questions related to the implementation details
Practice Time
1. Familiarize yourself with POSIX synchronization methods presented
in section 7.3
•
POSIX Mutex Locks
•
POSIX Semaphores
•
POSIX Condition Variables
2. Read the section 7.1.3 The Dining-Philosophers Problem.
Assignment Question
1.
The Dining-Philosophers Problem
Implement a solution to dining-philosopher problem using POSIX mutex
locks. Create five philosophers, each identified by a number 0..4. Each
philosopher will run as a separate thread. Philosophers alternate between
thinking and eating. To simulate both activities, have each thread sleep