Question: Write a program that spawns and controls multiple processes. The program should use system calls such as fork( ), wait( ), execvp( ) to manage

Write a program that spawns and controls multiple processes. The program should use system calls such as fork( ), wait( ), execvp( ) to manage the processes. The program should use signal system calls to communicate between the processes. The process should coordinate a single command structure where the main process is base and the child processes are planes. The base process is the main process. It should run in a simple loop, prompting the user for an input command. Valid input commands include launch, bomb N, status, refuel N, and quit. Invalid commands should produce a suitable error message. Upon receiving the command to quit, the program should end. The launch command should cause a child process to start. All child processes should execute the same code. All child processes should execute a simple loop, counting fuel downward from 100 at a rate of 5 fuel/second. Every 3 seconds, it should report its fuel status by printing out the line Bomber N to base, # fuel left, where N is the childs process ID.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!