OS Full Journal
OS Full Journal
SYSTEM
/ /
/ / 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-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
Practical 1
Source code:
Output:
Conclusion :- Program executed successfully.
Example 1: Program example for swapping 2 numbers.
Source code:
Output:
Source code:
Output:
Source code:
Output:
Source code:
Output:
Source code:
Output:
Conclusion :- Program executed successfully.
Practical 3
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:
Source code:
Output:
Example 2: Program for selection sort.
Source code:
Output:
Practical 2
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
Source code:
Output:
Example 1: Program to find HCF (GCD) and LCM.
Source code:
Output:
Source code:
Output:
Practical 1
Source code:
Output:
Conclusion :- Program executed successfully.
Example 1: Program for matrix addition.
Source code:
Output:
Source code:
Output:
Source code:
Output:
Source code:
Output:
Conclusion :- Program executed successfully.
Example-2: Program how to copy content of one file into another.
Source code:
Output:
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:
Source code:
Output:
● 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
Source code:
Output:
Source code:
Output:
Source code:
Output:
● 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
Source code:
Output:
Conclusion :- Program executed successfully.
Example 1: Program to find square and cube of given number.
Source code:
Output:
Source code:
Output:
● 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
Source code:
Output:
Source code:
Output:
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
Source code:
Output:
Source code:
Output:
Source code:
Output:
● 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:
Source code:
Output:
Source code:
Output:
● 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
Source code:
Output:
Conclusion :- Program executed successfully.
Example 1: Program to reverse a string entered by user.
Source code:
Output:
Source code:
Output: