0% found this document useful (0 votes)
50 views90 pages

OS Full Journal

This document outlines the course plan and schedule for an Operating Systems course. It lists 38 topics that will be covered over the semester, including theories on processes, threads, synchronization, scheduling algorithms and page replacement. Practical assignments involve implementing concepts like producer-consumer problems, thread usage, and scheduling algorithms in Java. Example programs are also provided to reinforce concepts from both theory and practical lessons in class and as homework.

Uploaded by

seema negi
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)
50 views90 pages

OS Full Journal

This document outlines the course plan and schedule for an Operating Systems course. It lists 38 topics that will be covered over the semester, including theories on processes, threads, synchronization, scheduling algorithms and page replacement. Practical assignments involve implementing concepts like producer-consumer problems, thread usage, and scheduling algorithms in Java. Example programs are also provided to reinforce concepts from both theory and practical lessons in class and as homework.

Uploaded by

seema negi
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/ 90

S.Y.B.Sc.

– COMPUTER SCIENCE SEMESTER - III


SUBJECT: - OPERATING

SYSTEM

Roll No:18 SAYYED ZAMA MAHDI ZARI HAIDER


Roll No:18 SAYYED ZAMA MAHDI ZARI HAIDER
Prof. Name: Mr. Sayyed Zama Mahdi Zari Class/Sem.: S.Y. B.Sc. (C.S.)/Semester - III
Haider
Course Code:USCS303 Subject Name: Operating System

Sr. Date Index Pg Sign


No. No.
Theory-1: Process Communication:
….. …..
/ / Practical-1: ​Give solution to the producer–consumer problem using shared memory. ….. …..
1.
2. / / Example-1: ​Program example for swapping 2number. ​(IT Lab) ….. …..
3.
/ / Example-2​: ​Program to find largest of given 3 number.
/ / (HOMEWORK) ….. …..
4. / / ….. …..
5. Practical-2: ​Give solution to the producer–consumer problem us in message passing. ….. …..
6. / / Example-1​:​Program to find smallest of given number.​(IT Lab)
Example-2: ​Program to convert lower case into upper case. Strop () function is a non - standard ….. …..
7. / / function. So, all compilers may not support. ​(HOMEWORK)
Practical-3: ​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 and a different Java virtual machine (JVM). ….. …..
8. / / ….. …..
// Demonstrate RMI program for adding/subtracting/multiplying/ dividing two numbers.
9. Example-1: ​Program to find array size. ​(IT Lab)
Example-2: ​What is strong number and need program to find strong number. ​(HOMEWORK)
….. …..
/ / Theory-2 : Threads
10.
Practical-1: ​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 objectProgram for linear ….. …..
11. / / search ​.
12. Example-1 ​Program for insertion sort ​(IT Lab)
Example-2: ​Program for selection sort​.​(Homework) ….. …..
/ /
13. Practical-2: ​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 ….. …..
14. / / then create a separate thread that outputs all the prime numbers less than or equal to the number entered …. …..
/ / by the user.
15.
Example-1: ​Program for bubble sort​. ​(IT Lab)
/ / Example-2: ​Program for linear search​. ​(HOMEWORK) ….. …..
16.
Practical-3: ​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
17. sequence using either the Java.
18. Example-1: ​Program to find HCF (GCD) and LCM ​(HOMEWORK)
Example-2: ​Program to check whether given number is positive or negative​. ​(HOMEWORK)

/ /
/ / Theory-3 : ​Synchronization:​. ….. …..
/ / ….. …..
19. / / Practical-1: ​Give Java solution to Bounded buffer problem. ….. …..
20. / / Example-1: ​Program for matrix addition​. ​(IT Lab) ….. …..
21. Example-2: ​Program will find sum of N numbers​. ​(HOMEWORK) ….. …..
22. Practical-2: ​Give solution to the readers–writers problem using Java synchronization. ….. …..
23. / / Example-1: ​Program to sort given numbers in ascending order​. ​(IT Lab)
Example-2: ​Program how to copy content of one file into ….. …..
another​.​(HOMEWORK)
24.
Practical-3: ​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 barber shop 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 1
using Java synchronization.
25. / / Example 1: ​Programming code for real time Bank application program​. (IT Lab) ….. …..
26. / / Example 2: ​Program to convert lower case into upper case. Strupr () function is a non – standard function. ….. …..
So, all compilers may not support​.​(HOMEWORK)

Theory-4 :FCFS Scheduling Algorithm …..


….. …..
27. Practical-4: ​Implement FCFS scheduling algorithm in java. ….. …..
28. / / Example-1:Program for simple interest and compound …..
29. / / Interest.
/ / Example-2: Program to check given number is perfect number or not

….. …..
Theory-5 : SJFS Scheduling Algorithm ….. …..
….. …..
30. / / Practical-1: ​Implement SJF (with no preemption) scheduling algorithm in Java
31. / / Example-1: ​Program to find square and cube of given number ​(IT Lab)
32. / / Example-2: ​Program to find square and cube of given number​.
(HOMEWORK)
….. …..
….. …..
33. / / Theory-6 : RR Scheduling Algorithm ….. …..
34. / /
/ / Practical-1: ​Implement RR scheduling algorithm in Java​.
35. Example-1: ​Program to compare 2 arrays whether they are equal or not​. ​(IT
Lab) Example-2 ​Program to delete an element from an array​. ​(HOMEWORK) ….. …..
….. …..
36. / / Theory-7 :Bankers Algorithm …..
37. / / …..
38. // Practical-1: ​Write a Java program that implements the banker’s algorithm.
Example-1​:Program to reverse given string ​(IT Lab)
Example-2: ​Program to generate random numbers​.​(Homework)
….. …..

// …..
Theory-8 : FIFO Page Replacement Algorithm ….. …..
39. // …..
40. // Practical-1: ​Write a Java program that implements the FIFO page-replacement algorithm​.
41. Example-1: ​Program for simple interest and compound interest​.​(IT
Lab) Example-2:​Program to compare 2 numbers without if
statement​.​(HOMEWORK) …..
…..
// …..
42. / / ….. …..
43. / / Theory-9 : LRU Page Replacement Algorithm …..
44.
Practical-1: ​Write a Java program that implements the LRU page
replacement algorithm.
Example-1: ​Program for binary search ​(IT Lab)
Example-2: ​Program for linear …..
search​.​(HOMEWORK) ….. …..
….. …..
/ / …..
45. / /
46. / / Theory-10 : File System
47.
Practical-1: ​Design a File System in Java.
Example-1: ​Program to reverse a string entered by user ​(IT Lab)
Example-2: ​Program to find ASCII code of a character​.
(HOMEWORK)
Theory 1: ​Process Communication

● A process is cooperating if it is affected by the other processes executing in the system.


Cooperating process requires an inter process communication (IPC) mechanism.
● Inter process communication (IPC) is a mechanism which allows processes to
communicate each other and synchronize their actions.
● Two types of inter process communication (IPC) are Shared model and Message passing
model.

 
Practical 1

Aim: ​Give solution to the producer–consumer problem using shared memory.

Source code:
Output:
Conclusion ​:- Program executed successfully.
Example 1: ​Program example for swapping 2 numbers.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Example 2: ​Program to find largest of given 3 numbers.

Source code:

Output:

Conclusion ​:- Program executed successfully.


 
Practical 2

Aim: ​Give solution to the producer–consumer problem using message passing.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Example 1: ​Program to find smallest of given number.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Example 2: ​Program to convert lower case into upper case.

Source code:

Output:
Conclusion ​:- Program executed successfully.
 
Practical 3

Aim: ​Demonstrate RMI program for adding/subtracting/multiplying/ dividing two numbers.

Source code:

Algorithm:
Step 1: Start
Step 2: Define the class rmiserver
Step 3: Create the objects twox, twoy in try
Step 4: Register the objects twox, twoy Step 5:
Display the exception in catch
Output:
Conclusion ​:- Program executed successfully.
Example 1: ​Program to find array size.

Source code:

Output:
Conclusion ​:- Program executed successfully.
Example 2: ​What is strong number and need program to find strong number.

Source code:

Output:
Conclusion ​:- Program executed successfully.
Theory 2: ​Threads

● A thread generally is a basic unit of CPU utilization which has a thread ID, aprogram
counter, a register set, and a stack.
● It shares data section, and other operating system resources, such as open files and
signals with other threads belonging to the same process its code section.

 
Practical 1

Aim: ​The Java version of a multithreaded program that determines the summation of a non
negative integer.

Source code:
Output:

Conclusion ​:- Program executed successfully.


Example 1: ​Program for insertion sort

Source code:

Output:
Example 2: ​Program for selection sort.

Source code:

Output:
Practical 2

Aim: ​Write a multithreaded Java or C program that outputs prime numbers.

 Source code:

Output:
Conclusion ​:- Program executed successfully.
Example 1: ​Program for bubble sort.

 Source code:

Output:
Conclusion ​:- Program executed successfully.
Example 2: ​Program for linear search.

 Source code:

Output:
Practical 3

Aim: ​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.

 Source code:

Output:
Example 1: ​Program to find HCF (GCD) and LCM.

 
Source code:

Output:

Conclusion ​:- Program executed successfully.


Example 2: ​Program to check whether given number is positive or negative.

 Source code:

Output:

Conclusion ​:- Program executed successfully.


Theory 3: ​Synchronization

● Process Synchronization means sharing system resources by processes in a way that,


Concurrent access to shared data is handled thereby minimizing the chance of
inconsistent data.
● Maintaining data consistency demands mechanisms to ensure synchronized execution of
cooperating processes.

 
Practical 1

Aim: ​Give C or Java solution to Bounded buffer problem.

Source code:
Output:
Conclusion ​:- Program executed successfully.
Example 1: ​Program for matrix addition.

Source code:
Output:

Conclusion ​:- Program executed successfully.


Example 2: ​Program will find sum of N numbers.

Source code:

Output:

Conclusion ​:- Program executed successfully.


 
Practical 2

Aim: ​Give solution to the readers–writers problem using Java synchronization.

Source code:
Output:

Conclusion ​:- Program executed successfully.


Example-1: ​Program to sort given numbers in ascending order.

Source code:

Output:
Conclusion ​:- Program executed successfully.
Example-2: ​Program how to copy content of one file into another.

Source code:
Output:

Conclusion ​:- Program executed successfully.


 
Practical 2

Aim: ​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 barber shop 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.

Source code:
Output:
Conclusion ​:- Program executed successfully.
Example 1: ​Programming code for real time Bank application program​.

Source code:
 Output:

Conclusion ​:- Program executed successfully.


Example 2: ​Program to convert lower case into upper case.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Theory 4: ​FCFS Scheduling Algorithm

● First Come First Serve (FCFS) is the simplest algorithm it is also known as FIFO, FIFO is
basically queues of processes in the order that they arrive in the ready queue for
execution.
● In this the process that comes first will be executed first and next process stars only after
the previous process finished its execution.

 
Practical 1

Aim: ​Implement FCFS scheduling algorithm in java.

Source code:
Output:

Conclusion ​:- Program executed successfully.


Example 1: ​Program for simple interest and compound Interest.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Example 2: ​Program to check given number is perfect number or not.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Theory 5: ​SJF Scheduling Algorithm

● Shortest job first is a scheduling algorithm in which the process with the smallest
execution time is selected for execution next.
● Shortest job first can be either pre-emptive or non-pre-emptive. Owing to its simple
nature, shortest job first is considered optimal.
● It also reduces the average waiting time for other processes awaiting execution.

 Practical 1

Aim: ​Implement SJF (with no pre emption) scheduling algorithm in Java or C.

Source code:
Output:
Conclusion ​:- Program executed successfully.
Example 1: ​Program to find square and cube of given number.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Example 2: ​Program to find square and cube of given number.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Theory 6: ​RR Scheduling Algorithm

● Round Robin (RR) Scheduling is design specifically for time sharing systems and used by
CPU during execution of the process.
● It is similar to FCFS scheduling algorithm but the functionally of pre emption is the added to
switch between the processes. So it is called as pre emptive FIFO.

 
Practical 1

Aim: ​Implement RR scheduling algorithm in Java or C.

Source code:
Output:

Conclusion ​:- Program executed successfully.


 Example 1:

Source code:

Output:

Conclusion ​:- Program executed successfully.


 
Example 2:

Source code:

Output:
Conclusion ​:- Program executed successfully.
Theory 7: ​Bankers Algorithm

The banker’s algorithm is a resource allocation and deadlock avoidance algorithm that tests for
safety by simulating the allocation for predetermined maximum possible amounts of all
resources, then makes an “s-state” check to test for possible activities, before deciding
whether allocation should be allowed to continue.

 Practical 1

Aim​: Write a Java or C program that implements the banker’s algorithm.

Source code:
Output:

Conclusion ​:- Program executed successfully.


Example 1: ​Program to reverse given string.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Example 2: ​Program to generate random numbers.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Theory 8: ​FIFO Page Replacement Algorithm

● In operating systems that use paging for memory management, page replacement
algorithm are needed to decide which page needed to be replaced when new page
comes in.
● Whenever a new page is referred and not present in memory, page fault occurs and
Operating System replaces one of the existing pages with newly needed page.

 
Practical 1

Aim: ​Write a Java or C program that implements the FIFO page-replacement algorithm.

Source code:
Output:

Conclusion ​:- Program executed successfully.


Example 1: ​Program for simple interest and compound interest.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Example 2: ​Program to compare 2 numbers without if statement.

Source code:

Output:

Conclusion ​:- Program executed successfully.


Theory 9: ​LRU Page Replacement Algorithm

● In operating systems that use paging for memory management, page replacement
algorithm are needed to decide which page needed to be replaced when new page
comes in.
● Whenever a new page is referred and not present in memory, page fault occurs and
Operating System replaces one of the existing pages with newly needed page.

 
Practical 1

Aim: ​Write a Java or C program that implements the LRU page replacement algorithm.

Source code:
Output:
Conclusion ​:- Program executed successfully.
Example 1: ​Program for binary search.

Source code:

Output:
Conclusion ​:- Program executed successfully.
Example 2: ​Program for linear search.

Source code:

Output:
Conclusion ​:- Program executed successfully.
Theory 10: ​File System

File system is the part of the operating system which is responsible for file management. It
provides a mechanism to store the data and access to the file contents including data and
programs. Some Operating systems treats everything as a file for example Ubuntu.

 
Practical 1

Aim: ​Design a File System in Java or C.

 Source code:

Output:
Conclusion ​:- Program executed successfully.
Example 1: ​Program to reverse a string entered by user.

 Source code:

Output:

Conclusion ​:- Program executed successfully.


Example 2​: Program to find ASCII code of a character.

 Source code:

Output:

Conclusion ​:- Program executed successfully.

You might also like