0% found this document useful (0 votes)
7 views1 page

Lab Assignment 9

Uploaded by

Priyanka Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Lab Assignment 9

Uploaded by

Priyanka Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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