BSc CS sem 3 Operating System Practical solution Download




Practical List

Practical can be implemented either in JAVA or any other programming language.

1. Process Communication:
(i) Give solution to the producer–consumer problem using shared memory.
(ii) Give solution to the producer–consumer problem using message passing.
(iii) One form of communication in a Client–Server Systems environment is Remote
method invocation (RMI). RMI is a Java feature similar to RPCs. RMI allows a thread
to invoke a method on a remote object. Objects are considered remote if they reside in a
different Java virtual machine (JVM). Demonstrate RMI program for
adding/subtracting/multiplying/dividing two numbers.

2. Threads:
(i) The Java version of a multithreaded program that determines the summation of a
non-negative integer. The Summation class implements the Runnable interface. Thread
creation is performed by creating an object instance of the Thread class and passing the
constructor a Runnable object.
(ii) Write a multithreaded Java program that outputs prime numbers. This program should
work as follows: The user will run the program and will enter a number on the
command line. The program will then create a separate thread that outputs all the prime
numbers less than or equal to the number entered by the user.
(iii) The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5. 8, ... Formally, it can be
expressed as: fib0 = 0, fib1 = 1, fibn = fibn-1 + fibn-2 Write a multithreaded program that
generates the Fibonacci sequence using either the Java,

3. Synchronization:
(i) Give Java solution to Bounded buffer problem.
(ii) Give solution to the readers–writers problem using Java synchronization.
(iii) The Sleeping-Barber Problem: A barber shop consists of awaiting room with n chairs
and a barber room with one barber chair. If there are no customers to be served, the
barber goes to sleep. If a customer enters the barbershop and all chairs are occupied,
then the customer leaves the shop. If the barber is busy but chairs are available, then the
customer sits in one of the free chairs. If the barber is asleep, the customer wakes up the
barber. Write a program to coordinate the barber and the customers using Java
synchronization.

4. Implement FCFS scheduling algorithm in Java.

5. Implement SJF (with no preemption) scheduling algorithm in Java

6. Implement RR scheduling algorithm in Java

7. Write a Java program that implements the banker’s algorithm

8. Write a Java program that implements the FIFO page-replacement algorithm.

9. Write a Java program that implements the LRU page-replacement algorithm.

10. Design a File System in Java.