3 different problems solved with multithreading. University project [no.2] for Concurrent Programming (Fall 2017).
Create Mandelbrot set by dividing into N parts, where each calculates has an individual painting work. Implemented by having each part of the work assigned to a thread that returns to the main thread, which paints the results.
Control the traffic over a 2-way bridge, so that:
- There are no cars moving both ways
- There are no more than N cars on the bridge at any time
- There can't be any car waiting forever Implemented with 2 threads in each entrance of the bridge, by using semaphores.
A roller coaster fits N passengers and starts only when it's full. Passengers get off when the roller coaster has finished the ride and before the new passengers come. Implemented a synchronization between passengers and roller coaster, where there is one thread for passenger and one for the roller coaster.
- C
- Make (sudo apt install make)
- GCC (sudo apt install gcc)
On terminal, run make
to build the executable C program.
Start each problem's program with ./[program name]
.
ECE321 Concurrent Programming
Assigment instructions can be found here in Greek.