Demonstrate that the two processes alternately execute for


Write a program that places itself under the SCHED_FIFO scheduling policy and then creates a child process. Both processes should execute a function that causes the process to consume a maximum of 3 seconds of CPU time. (This can be done by using a loop in which the times() system call is repeatedly called to determine the amount of CPU time so far consumed.) After each quarter of a second of consumed CPU time, the function should print a message that displays the process ID and the amount of CPU time so far consumed. After each second of consumed CPU time, the function should call sched_yield() to yield the CPU to the other process. (Alternatively, the processes could raise each other's scheduling priority using sched_setparam().) The program's output should demonstrate that the two processes alternately execute for 1 second of CPU time. (Note carefully the advice given in Section 35.3.2 about preventing a runaway realtime process from hogging the CPU.)

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Demonstrate that the two processes alternately execute for
Reference No:- TGS01402514

Expected delivery within 24 Hours