Develop a program to regulate vehicle traffic over a narrow bridge to ensure the following properties: 1. There are no vehicles moving in opposite directions on the bridge. 2. There shall be no more than N vehicles on the bridge. 3. A vehicle is not allowed to wait forever to cross the bridge, even if vehicles are constantly arriving on the other side of the bridge. You must code in C the solution of this problem. You will only need an editor to write your code and a gcc compiler.
One of the objectives is to get better with using C as it is an intermediate problem for C programmers as it requires advanced methods to solve it. Specifically, after implementing the problem, students will become familiar with: 1. Understanding the problem of synchronization in concurrent systems. 2. Knowledge of basic synchronization mechanisms, and understanding of how they are implemented in operating systems and / or a higher-level execution environment. 3. Knowledge of a classic synchronization problem and its solutions in different ways, and understanding of how such solutions are constructed. 4. Knowledge of the basic functions of concurrent programming and synchronization in C, and their practical application.
The contents of the course are the following: The concurrent execution model. The problem of mutual exclusion. Implementation-based mutual algorithms. Specific hardware synchronization commands. Semaphores. Auditors / observers. Critical Conditional Areas. Simultaneous programming and synchronization in C / pthreads.