OS Lab Mannual 2025
OS Lab Mannual 2025
CS-29002
Operating Systems Laboratory
Course objectives: The objective of this lab is to give an idea about different components of
operating system and their interactions happened in an operating system. Specifically, in this
course, we mostly focus on the UNIX operating system, where student can get the practical
understanding about how to manage the processes with respect to process creation, process
communication process synchronization, threading, manage file, etc.
List Experiments
Lab 1:
UNIX commands
How to write and execute a shell program
Expression evaluation and command line arguments
Assignments
Lab 2:
logical operator, relational operator used in bash shell
How to write down the conditional statements in bash shell using logical and
relational operator?
Different control statements (if, elif, case, while, for)
Assignments
1. Write a shell program to find whether a given year is a leap year or not.
2. Write a shell program to find greatest among three numbers.
3. Write a shell program to display the prime number between 1 and hundred.
4. Execute the “ps -ef” and “ps -ux” command. Write a shell program that takes the
output of these two commands and display the detail about a process whose parent id
is 2. The detail about a process will be shown as it is shown during the execution of
“ps -ux” command.
5. Write a shell script to extract the data from the date command, and display the result
in numerical form with 12 hour format. (if the date command gives “Thu Jan 2
14:21:54 IST 2014” then display the result in “02/01/2014/2:21:54 PM”)
6. Let a directory present in the home directory called “XYZ” that consists of few files
and directories. Write a shell script to move all the files present in the “XYZ”
directory to a subdirectory called “MyFile” and all the subdirectories present in the
“XYZ” directory to a subdirectory called “MyDir”.
Lab 3:
Different Loop statements (while, for, until, case)
Assignments
Lab 4:
Implementation of array in shell script.
Assignments
1. Write a shell script that will take 3 file names as command line argument and
concatenate first two files line by line and store the result in third file.
2. Write a shell script that will store all the files in different directory named as x_1, x_2,
… where maximum size of each directory is X.
Lab 5:
Discuss a generalized way to design the CPU scheduling algorithm
Assignments
1. FCFS algorithm implementation in C using structure / linked list
2. SJF (non-preemptive) algorithm implementation in C
Lab 6:
Discuss a generalized way to implement preemptive CPU scheduling algorithms
Assignments
1. Preemptive SJF algorithm implementation in C using structure / linked list
2. Round robin algorithm implementation in C
Lab 7:
Discuss basics of round robin algorithm implementation
How to create a processes using fork system call
Use of wait function
Assignments
Note: “child has terminated”--- this sentence does not print before “1.Hello from
child”because of wait.
Lab 8:
Discuss about process communication using pipe
o how to create pipe between two processes
o What is the use dup function? How it can be utilized in pipe line commands
Assignments
1. Write a program that creates n level process structure where each level consists of
exactly one process. Here every parent process makes some modification to the
original message and sends it to its child and this process repeats till it reached at the
last child in the process tree.
2. Write a program to create a ring topology among n number of process and message
has to be passed using the pipe in clock wise or anti clock wise direction.
Lab 9:
Discuss the thread creation using pthread library
Assignments
1. Write a program to create two threads where one thread adds half of the element from
the beginning of the array and another thread add half of the element from the end of
the array. And at the end main process shows the sum of all the elements in the given
array.
2. Write a program to implement the merge sort using multiple threads
Lab 10:
Discuss different functions related to Mutex lock using POSIX library
Discuss different functions related to conditional variable using POSIX library
Discuss different functions related to semaphore using POSIX library
Assignment
Home Assignments:
Producer consumer problem using semaphore
Producer consumer problem using mutex lock
Dining philosophers problem using semaphore
Dining philosophers problem using mutex lock
Guidelines
1. Students should be regular and come prepared for each laboratory class.
2. Students should bring their lab record and practice note books to every class.
3. The prescribed text and reference books and class notes can be kept ready for reference if
required.
4. Students have to complete their lab experiments in the lab and be capable to explain and
show the modifications, output results as and when required by the Faculty/Lab
Programmers/Teaching Assistants responsible for that lab. All these are to ensure that the
students’ capability is built up to understand, debug and modify codes as per the
requirements.
5. In case a student misses a class, it is his/her responsibility to complete the missed
experiment(s).
6. The code written by the student should meet the following:
i) Program should have proper input prompt messages (Menu Driven) and descriptive
output.
ii) Input validation should be done (data type, range error etc.) and give appropriate
error messages and suggest corrective actions.
iii) Comment lines should be used to give Students Name, Roll No, Branch, Section,
Subject, Problem Statement, describe functions, Expected Input & Output and all the
key Logic.
iv) Program should be indented properly. Variables and functions should be
meaningfully named. [USE CODING STANDARDS].
v) Try to optimize the code wherever possible.
7. All programs should be verified by different values and lengthy inputs. [with minimum
VALIDATIONS]
8. Once the experiment(s) get executed, they should show the program and results to the
Faculty/Lab Programmers/Teaching Assistants responsible for that lab. and copy the same in
their observation book and get signed which ensures him/her with day to day performance
marks
9. Student should submit his/her record by/in the next lab session to ensure the lab record marks
gets evaluated. Failing to do so reduces the lab record marks.
10. Lab examination questions need not necessarily be limited to the questions in the
laboratory manual, rather it could include some variations and/or combinations of questions.
11. Students are strictly advised to take care of their personal belonging all the time. The
University is not responsible and liable to any lost of personal belonging in the computer
labs.
Scheme of Evaluation
Maximum marks is 100, which is divided into Continuous Internal Assessment and End-Sem
Final Evaluations.