Question
Write the init program in C, which will fork off the two child processes. Decide how to implement the two-way IPC. You can use a
Write the init program in C, which will fork off the two child processes.
Decide how to implement the two-way IPC. You can use a TCP socket, a two-way pipe (mkfifo), shared memory*, or two one-way pipes*. Think about why you chose one way over the other, and include a comment about it in your summary write-up. (*you would probably need to use the init program as the CPU emulator for these methods to work).
Implement the CPU emulator, which simply receives PCB information, decrements the number of remaining CPU cycles of the PCB by a fixed amount, and sends it back to the scheduler.
Implement the scheduler, which reads process data from a file, adds the processes to a queue, then pops the front, sends it to the CPU, receives process data back from the CPU, and appends the process to the back of the queue (if it has not completed yet).
process list:
process_name, PID, state, priority, interruptable, est_total_run_time, est_remaining_run_time
ls,1000,ready,1,0,360,360 wc,1001,ready,3,0,120,120 cat,1002,ready,2,0,430,430 sed,1003,ready,1,0,411,411 ps,1004,ready,1,0,360,360 grep,1005,ready,2,0,430,430 python,1006,ready,4,0,560,560
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