System engineer

You work as a system engineer team for Universal Studios, which is currently in the process of designing a Jurassic Park ride at the theme park. You are in charge of designing the waiting area, God-forsaken land of ropes, where people going around in circles. Here are specifications: • The ride consists of putting MAXPERCAR or less people on a Ford Explorer and sending through a small-scale version of Jurassic Park where the dinosaurs run loosely and attack tourists. • The process is semi-continuous, as an empty Explorer will arrive at the embarkation periodically. You have been told by industrial engineers that it takes 7 seconds to load the people into the car and to send them on their way and another 53 seconds to complete the ride. • But not every car is completely full, as the number of people waiting on line may be less than MAXPERCAR. • The en-queuing rate is variable, as people get in line at various rates during the day. You can assume all people arrival at beginning of every minute. The mean value of arrival rate varies as follows: o 09:00:00–10:59:59, meanArrival = 25 persons per minute o 11:00:00–13:59:59, meanArrival = 45 persons per minute o 14:00:00–15:59:59, meanArrival = 35 persons per minute o 16:00:00–18:59:59, meanArrival = 25 persons per minute • At the beginning of every minute, we can decide the number people who will arrive in this minute by calling poissonRandom(meanArrival), provided in file random437.h. • Assume there is a limit on the number of people kept in the waiting area, MAXWAITPEOPLE(800). If more people come, they will be advised to come back later since the waiting line is too long. • You are going to design the waiting area where the lines will snake back and forth endlessly between roped-off guideways, before spilling over into the street. Your task is to simulate the waiting lines on a computer with multiple concurrent threads to observe the dynamics of the lines at different times during the day. • There are total CARNUM Explorers, you need to create a new thread for each of them. • You need a thread to take care of incoming people and decide that either accept them into the waiting line or reject some or all of them away. It will write a status line into an output file: “XXX arrive YYY reject ZZZ wait-line WWW at HH:MM:SS” where, XXX is the time step ranging from 0 to 599, YYY is the number of persons arrived, ZZZ is the number of persons rejected, WWW is number of persons in the waiting line, HH:MM:SS is hours, minutes, and seconds. At the end of the day, it will display: o The total number of people arrived o The total number of people taking the ride o The total number of people going away due to the long waiting line o The average waiting time per person (in minutes) o Determine the length of the line at its worst case, and the time of day at which that occurs. • All of your threads need to synchronize every minute. • You should C to implement your assignment. • Your implementation should not have any thread doing busy waiting. • Your program will take two options, “-N” CARNUM and “-M” MAXPERCAR, as its command line arguments, and run simulation from 9am to 7pm. • You need to simulate 10 hours (600 minutes) between 9:00am – 7:00pm. You could synchronize a virtual minute to a real second (or 10ms or 100ms).