Question: QUESTION NO 01 10 Marks Given below are the arrival and burst times of four processes P1, P2, P3 and P4. Using SJF preemptive and
QUESTION NO 01 10 Marks
Given below are the arrival and burst times of four processes P1, P2, P3 and P4. Using SJF preemptive and RR scheduling (Quantum = 5ms, no priority based preemption).
| PROCESS NO | Arrival time (msec) | Burst time(msec) |
| P1 | 2 | 7 |
| P2 | 3 | 3 |
| P3 | 4 | 5 |
| P4 | 6 | 6 |
Write a program to calculate the average waiting time, average turnaround time, average response time, throughput, and CPU utilization. For what percentage of does the CPU remain idle?
QUESTION NO 02 10 Marks
Memory management is the functionality of an operating system which handles or manages primary memory and moves processes back and forth between main memory and disk during execution. Memory management keeps track of each and every memory location, regardless of either it is allocated to some process or it is free.
Given five memory partitions of 110 KB, 450 KB, 100 KB, 250 KB, and 500 KB (in order), how would each of the first-fit, best-fit, and worst-fit algorithms place processes of 212 KB, 417 KB, 112 KB, and 426 KB (in order)?Which algorithm makes the most efficient use of memory? Write a program to compare and justify your answer.
QUESTION NO 04 10 Marks
Producer-consumer problem is a common paradigm for cooperating processes. A producer process produces information that is consumed by a consumer process. One solution to the producer-consumer problem uses shared memory. To allow producer and consumer processes to run concurrently, there must be available a buffer of items that can be filled by the producer and emptied by the consumer. This buffer will reside in a region of memory that is shared by the producer and consumer processes. A producer can produce one item while the consumer is consuming another item. The producer and consumer must be synchronized, so that the consumer does not try to consume an item that has not yet been produced.
Write a bash script to simulate producer-consumer problem using semaphores.
NOTE: All questions required code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
