(Synchronization using Semaphores)
A particular river crossing is shared by both cannibals and missionaries. A boat is used to cross the river but it only seats three people and must always carry a full load. In order to guarantee the safety of the missionaries, you can *not* put one missionary and two cannibals into the same boat (because cannibals would gang up and eat that single missionary), but all other combinations are legal.
Your program will first ask the number of missionaries and cannibals. The number of cannibals must be greater than one, and the number of missionaries must be greater than two, finally the total number of persons should be multiples of three.
First, you should create processes for each cannibal and missionaries. They will walk to the river bank for a while (arrival times are random, you can use sleep call here). Two procedures are needed, Missionary_Arrived and Cannibal_Arrived called by missionary or cannibal processes when they arrive the river bank. These procedures are responsible for synchronization. And these procedures arrange arriving missionaries and cannibals into safe boatloads. Once the boat is full, one process calls Raw_Boat and after calling Row_Boat, the three procedures then return. Then a new boat arrives. There should also be no undue waiting; that is missionaries and cannibals should not wait if there are enough of them for a safe boatload.
Your program should display how a boat is arranged each time and who is on the boat. If there are any persons left at the end of your program, they must be reported.
Remember that, all the synchronization operations should be mutually exclusive. You must use UNIX semaphores to enable synchronization.
Students who implement the assignment successfully will submit the assigment with one file attached (not pasted into message body!): <studentnumber>-assignment3.c, and README_3_<studentnumber> . A short description of usage and implementation will be included in the README file. Do not forget to include your full name and student ID number in your message body and check for the auto response generated to ensure a proper submission.