OS Lab Mannual 2024
OS Lab Mannual 2024
OS Lab Mannual 2024
Faculty: Section:
Software Requirements
● GCC compiler
● Unix platform (Currently used Ubuntu12.04 LTS)
Hardware Requirements
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.
Lab 1:
● UNIX commands
● How to write and execute a shell program
● Expression evaluation and command line arguments
● Assignments
1. Verify different UNIX commands (syntax to use with options)
Some list (but not limited): basename, mkdir, ls, echo, read, expr, kill,
who, which, date, users, vim, touch, bash, cat, hostname, rm, mv,
chmod, top and so on.
2. Write a shell program to add two numbers using command line argument.
3. Write a shell program to convert distance into meter, cm and km.
4. Write a shell script to extract the data from the date command, and display the
result in different format.(if the date command gives “Thu Jan 2 14:21:54 IST
2014” then display the result in “2/Jan/2014/14.21”)
Vary the date commend with different options.
Lab 2:
o Write a shell program to display the prime number between 1 and hundred.
o 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.
o 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”)
o 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:
o Write a shell script to verify whether the given string is a palindrome or not.
o Write a shell program which takes maximum 8 integer type arguments through
command line and do the following operation:
▪ If the first argument/last result (a) is divisible by send argument (b)
then new result=a/b
▪ Else If (a%b != 0) and b is divisible by 5 then new result=a*b
▪ Else if (a>b) then new result=a-b
▪ Else new result=a+b
Lab 4:
o 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:
● Home assignments
o SJF(non-preemptive) algorithm implementation in C
Lab 6:
Lab 7:
o Write a program where a process waits for all its child processes
Note: “child has terminated”--- this sentence does not print before “1.Hello from
child”because of wait.
Lab 8:
● Home assignment
o 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:
Lab 10:
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 for Database Lab is 100, which is divided into Continuous Internal
Assessment and End-Sem Final Evaluations.