Lab Manual Operating System 29sep18
Lab Manual Operating System 29sep18
LAB MANUAL
Date of Faculty
Lab No. Topics to be covered
Practical Signature
Write a Program to implement FCFS CPU scheduling
1 algorithm.
Write a Program to implement SJF CPU scheduling
2 algorithm.
Write a Program to implement Priority CPU Scheduling
3 algorithm.
Write a Program to implement Round Robin CPU
4 scheduling algorithm.
3. Get the value for burst time of each process from the user
4. Having allocated the burst time(bt) for individual processes , Start with the first process
from it’s initial position let other process to be in queue
tat(pi) = wt(pi) + bt(pi) (i.e tat of current process = wt of current process + bt of current
process)
6. Calculate the total and average waiting time and turnaround time
Program:
EXPERIMENT 2
Algorithm:
3. Sort the processes according to the burst time and allocate the one with shortest burst to
execute first
4. If two processes have same burst length then FCFS scheduling algorithm is used
5. Calculate the total and average waiting time and turnaround time
Program:
EXPERIMENT 3
Algorithm:
4. Sort the processes according to the priority and allocate the one with highest priority to
execute first
5. If two process have same priority then FCFS scheduling algorithm is used
6. Calculate the total and average waiting time and turnaround time
Program:
EXPERIMENT 4
Algorithm:
5. Make the CPU scheduler go around the ready queue allocating CPU to each process for
the time interval specified
6. Make the CPU scheduler pick the first process and set time to interrupt after quantum.
And after it's expiry dispatch the process
7. If the process has burst time less than the time quantum then the process is released by
the CPU
8. If the process has burst time greater than time quantum then it is interrupted by the OS
and the process is put to the tail of ready queue and the schedule selects next process from
head of the queue
9. Calculate the total and average waiting time and turnaround time
Program:
EXPERIMENT 5
AIM: Program to implement Deadlock.
Program:
EXPERIMENT 6
AIM: Program to implement classical inter process communication problem (producer consumer)
Algorithm:
The producer-consumer problem illustrates the need for synchronization in systems where
many processes share a resource. In the problem, two processes share a fixed-size buffer.
One process produces information and puts it in the buffer, while the other process
consumes information from the buffer. These processes do not take turns accessing the
buffer, they both work concurrently. Here in lies the problem. What happens if the producer
tries to put an item into a full buffer? What happens if the consumer tries to take an item
from an empty buffer?
In order to synchronize these processes, we will block the producer when the buffer is full,
and we will block the consumer when the buffer is empty. So the two processes, Producer
and Consumer, should work as follows:
Program:
EXPERIMENT 7
AIM: Program to implement classical inter process communication problem (Reader Writers).
Program:
EXPERIMENT 8
AIM: Program to implement classical inter process communication problem (Dining Philosophers).
Program:
EXPERIMENT 9
AIM: Program to implement FIFO page replacement algorithm.
ALGORITHM
4. Check the need of replacement from old page to new page in memory
Program:
EXPERIMENT 10
AIM: Program to implement LRU page replacement algorithm.
ALGORITHM
Program: