Lab Assignment 9

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

MOTILAL NEHRU NATIONAL INSTITUTE OF TECHNOLOGY

Data Structures and Operating Systems Lab

Lab Assignment 9

1. Write a program to simulate the lifecycle of a process. Implement the following


stages:
a) New: Create a new process.
b) Ready: Transition the process to the ready state.
c) Running: Simulate the process running.
d) Terminated: End the process.

2. Write a program to implement First-Come, First-Served (FCFS) CPU scheduling for


processes. Take process arrival time and burst time as input and calculate the average
waiting time and turnaround time.

3. Write a program to simulate the First-In-First-Out (FIFO) page replacement algorithm.


Take the number of frames and a reference string as input and calculate page faults.

4. Simulate the Producer-Consumer problem using semaphores. Implement a producer


that generates items and a consumer that consumes them from a shared buffer.

5. Write a program to solve the Readers-Writers problem using semaphores. Ensure that
multiple readers can read at the same time, but only one writer can write at a time.

You might also like