Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Instant Rate but will rate only if it works fine on gcc compiler. Write a progra

ID: 3550226 • Letter: I

Question

Instant Rate but will rate only if it works fine on gcc compiler.


Write a program in C to simulate CPU task scheduler. The simulation should follow the below flowchart: The task arrival times should follow Poisson distribution, with lambda defined by user. The generated tasks should in between contain 0-2 I/O bursts. The duration of CPU and I/O bursts should be 1-5 time units. The time unit value (in milliseconds) will be defined by user Use Round-Robin with FIFO policy for CPU scheduling, with time-slice of 2 time units. Use Normal FIFO for I/O scheduling. Both the CPU and I/O device should serve only one task at a time. To simulate CPU and I/O execution, use asleep() function defined in 'p thread h' You can use POSIX thread library 'p thread h' for simultaneously creating and executing tasks. Refer the below link for tutorial Lambda (in tasks/time unit) - need not be integer Simulation time (in time units) Time unit duration (in milliseconds) During the simulation print the tasks as it is created, queued, executed and completed. After every 5 time units of simulation, print current length of ready queue and I/O queue. At the end of simulation, print total number of jobs generated, completed and still queued. Also find and print the optimum queue-size of both the queues. (t=1) Task 1 generated, moved to ready queue (t=1)Task 1 granted CPU access (t=2) Task 2 generated, moved to ready queue (t=3) Task 3 generated, moved to ready queue (t=3) Task 1 time-slice expired, moved to ready queue (t=3) Task 2 granted CPU access (t=4) Task 2 requested for I/O. moved to I/O queue (t=4) Task 2 granted I/O access (t=4) Task 3 granted CPU access (t=5) Task 3 completed (t=5)Task 1 granted CPU access (t=5) Task 2 I/O request completed moved to ready queue (t=5) READY QUEUE LENGTH = 1, I/O QUEUE LENGTH = 0 Submit a single c file with name as your roll number. Comment the code wherever necessary, else marks will be deducted. The code must compile successfully in gcc compiler. NOTE: You will require Linux operating system for compiling and executing the code, as 'p thread h' and unistd h' are not available for Windows. If not already installed, you can try Ubuntu using Wubi. by referring the below link

Explanation / Answer