/************************************************************ File: main.cc Description: A program that simulates the problem of the five philosophers. Author: Dana Vrajitoru Organization: IUSB Date: August 22, 2018 **************************************************************/ #include #include using namespace std; #include "solution2.h" int main() { int no_threads = PHIL_NR; pthread_t threads[PHIL_NR]; srand(100); Input_iters(); Init_semaphores(); Create_threads(threads); Synchronise(threads); Write_stats(); } /******************* Example of output ********************** Enter the number of iterations 10 Philosopher nr 0 has eaten 4 times and meditated 10 times. Philosopher nr 1 has eaten 8 times and meditated 10 times. Philosopher nr 2 has eaten 0 times and meditated 10 times. Philosopher nr 3 has eaten 9 times and meditated 10 times. Philosopher nr 4 has eaten 8 times and meditated 10 times. **************************************************************/