Question
Using C on Linux with Linux specific concurrency constructs, develop a program to simulate airport flight operation procedure. You can look at the sample code
Using C on Linux with Linux specific concurrency constructs, develop a program to simulate airport flight operation procedure. You can look at the sample code for the barbershop to get an idea as to how to start. The following persons are involved in flight operations: passenger, checkin agent, security officer and gate keeper. Hire a reasonable number of employees (less than or equal to 7) and start at least 25 passengers in parallel. As an example, you can employ two checkin agents, two security guards and one gate keeper. All persons must be simulated as separate processes. Do not call one process from another and synchronize and coordinate through concurrency mechanisms. Print meaningful messages from each process to show the events such as passenger waiting to checkin boarding pass issued, security cleared passenger boarded the plane.
Barbershop sample pseudocode (This code is not runnable; it is listed as an example only. You can see that all persons are simulated through separate processes.)
/* program barbershop1 */
semaphore max_capacity = 20;
semaphore sofa = 4;
semaphore barber_chair = 3;
semaphore coord = 3;
semaphore cust_ready = 0, finished = 0, leave_b_chair = 0, payment= 0, receipt = 0;
void customer ()
{
wait(max_capacity);
enter_shop();
wait(sofa);
sit_on_sofa();
wait(barber_chair);
get_up_from_sofa();
signal(sofa);
sit_in_barber_chair();
signal(cust_ready);
wait(finished);
leave_barber_chair();
signal(leave_b_chair);
pay();
signal(payment);
wait(receipt);
exit_shop();
signal(max_capacity);
}
void barber()
{
while (true)
{
wait(cust_ready);
wait(coord);
cut_hair();
signal(coord);
signal(finished);
wait(leave_b_chair);
signal(barber_chair);
}
}
void cashier()
{
while (true)
{
wait(payment);
wait(coord);
accept_pay();
signal(coord);
signal(receipt);
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started