Os Iv 11072023
Os Iv 11072023
Os Iv 11072023
LABORATORY MANUAL
B.Tech. Semester- IV
DEPARTMENT OF CSE/CSIT/IT/IOT
DRONACHARYA COLLEGE OF ENGINEERING
KHENTAWAS, FARRUKH NAGAR, GURUGRAM (HARYANA)
Operating System Lab (LC-CSE-212G)
Table of Contents
1. Vision and Mission of the Institute
2. Vision and Mission of the Department
3. Programme Educational Objectives (PEOs)
4. Programme Outcomes (POs)
5. Programme Specific Outcomes (PSOs)
6. University Syllabus
7. Course Outcomes (COs)
8. CO- PO and CO-PSO mapping
9. Course Overview
10. List of Experiments
11. DOs and DON’Ts
12. General Safety Precautions
13. Guidelines for students for report preparation
14. Lab assessment criteria
15. Lab Experiments
Vision:
“To impart Quality Education, to give an enviable growth to seekers of learning, to groom them
as World Class Engineers and managers competent to match the expending expectations of the
Corporate World has been ever enlarging vision extending to new horizons of Dronacharya
College of Engineering”
Mission:
M1: To prepare students for full and ethical participation in a diverse society and encourage
lifelong learning by following the principle of ‘Shiksha evam Sahayata’ i.e., Education &
Help.
M2: To impart high-quality education, knowledge and technology through rigorous academic
programs, cutting-edge research, & Industry collaborations, with a focus on producing
engineers& managers who are socially responsible, globally aware, & equipped to address
complex challenges.
M3: Educate students in the best practices of the field as well as integrate the latest research into
the academics.
M4: Provide quality learning experiences through effective classroom practices, innovative
teaching practices and opportunities for meaningful interactions between students and
faculty.
M5: To devise and implement programmes of education in technology that are relevant to the
changing needs of society, in terms of breadth of diversity and depth of specialization.
Vision:
“To become a Centre of Excellence in teaching and research in Information Technology for
producing skilled professionals having a zeal to serve society”
Mission:
M1: To create an environment where students can be equipped with strong fundamental concepts,
programming and problem-solving skills.
M3: To promote Research and Development in the frontier areas of Information Technology and
encourage students for pursuing higher education
M4: To inculcate in students ethics, professional values, team work and leadership skills.
PO5: Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
PO6: The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
PO7: Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and
need for sustainable development.
PO8: Ethics: Apply ethical principles and commit to professional ethics and responsibilities
and norms of the engineering practice.
P11: Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member
and leader in a team, to manage projects and in multidisciplinary environments.
P12: Life-long learning: Recognize the need for and have the preparation and ability to engage
in independent and life-long learning in the broadest context of technological chan
University Syllabus
5. Introduction to VI Editors.
CO1: Understand the structure and architectural components of UNIX Operating System to
analyze and design the problem. Moreover, students would be able to know the Basic Introduction
of UNIX Operating System.
CO2: Basic Introduction of UNIX Commands that are used for operating the UNIX.
CO3: Introduction of Shell Scripting and VI Editor.so that the students get familiar with writing
the UNIX scripts in UNIX editor.
CO4: Students will establish themselves as effective professionals by solving real problems with
UNIX Shell Scripting knowledge and with attention to teamwork, critical thinking and problem-
solving skills by Writing Shell Scrips of unknown problems
CO-PO Mapping
CO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
CO1 3 2 2 - - - - - - - - -
CO2 3 2 2 - - - - - - - - -
CO3 3 2 2 - - - - - - - - -
CO4 3 2 2 - - - - - - - - -
CO-PSO Mapping
CO PSO1 PSO2 PSO3 PSO4
CO1 3 2 1 -
CO2 3 2 1 -
CO3 3 2 1 -
CO4 3 2 1 -
Course Overview
Operating System Lab is a course that teaches students about the fundamentals of operating
systems. The lab sessions are designed to give students hands-on experience with operating system
concepts, such as process management, memory management, file systems, and inter-process
communication.
* Process management
* Memory management
* File systems
* Inter-process communication
* Scheduling
* Virtual memory
DON’Ts
1. Turn the equipment off. If power switch is not immediately accessible, take plug off.
2. If fire continues, try to curb the fire, if possible, by using the fire extinguisher or by covering
it with a heavy cloth if possible, isolate the burning equipment from the other surrounding
equipment.
3. Sound the fire alarm by activating the nearest alarm switch located in the hallway.
4. Call security and emergency department immediately:
Emergency : Reception
Security: Front Gate
1) All files must contain a title page followed by an index page. The files will not be signed by
the faculty without an entry in the index page.
2) Student’s Name, roll number and date of conduction of experiment must be written on all
pages.
3) For each experiment, the record must contain the following
(i) Aim/Objective of the experiment
(ii) Pre-experiment work (as given by the faculty)
(iii) Lab assignment questions and their solutions
(iv) Test Cases (if applicable to the course)
(v) Results/ output
Note:
1. Students must bring their lab record along with them whenever they come for the lab.
2. Students must ensure that their lab record is regularly evaluated.
AC4: All variants of input All variants of input Only few variants of Solution is not well
Execution & /output are tested, /output are not input /output are demonstrated and
Demonstration Solution is well tested, However, tested, implemented
demonstrated and solution is well Solution is well concept is not
implemented demonstrated and demonstrated but clearly explained
concept is clearly implemented implemented
explained concept is clearly concept is not
explained clearly explained
LAB EXPERIMENTS
PROGRAM NO. 1
PRE-EXPERIMENT QUESTIONS:
Date command:
Unix maintains a system clock. As for now you can simply display the current date with the date command,
which shows the
$ date +%m : This command shows current month(in digits) [eg. 08]
$ date +%h : This command shows current month(in words) [eg. Aug]
Cal command:
This command is used for printing the calendar of any particular month or the entire year.
The head command is used to display the top few records of the file. The syntax of the
command is as follows:
$ head -5 filename
The tail command displays the end few records of the file. If no line count is given, the tail command
displays the last ten lines of the file.
$ tail –3 emp.lst
To create a file:
$ cat >seema
is a good girl
To save a file:
ctrl+d
To display a file:
$ cat seema
is a good girl
ls:
$ ls – x
$ ls –a
$ cp dog jam
To rename a file:
$ mv fish whale
To remove a file:
$ rm whale
$ pwd
$ tput clear
To make a directory:
$ mkdir school
This command will create all the above directories in one go.
To remove a directory:
$ rmdir school
$ bc
12+5
12+5;12-5;12*5
Scale=2
14/3
$ exit
POST-EXPERIMENT QUESTIONS:
1. What is the purpose of the "ls" command in UNIX? How does it differ from "ls -l" and "ls -a"?
2. How do you create a new directory using the "mkdir" command? Can you create multiple directories at
once?
3. What is the purpose of the "cd" command? How do you navigate to a specific directory using this
command?
PROGRAM NO-2
PRE-EXPERIMENT QUESTIONS:
1. File commands.
(a) Copy
(b) Delete
C:\>del abc
(c) Rename
This command will rename the file name abc to file name xyz.
(d) Type
C:\>type xyz
2. Directory command
(a) DIR
C:\>Dir
(b) CHDIR
C:\> cd e:
E:\>
C:\>cd..
C:\> cd\
C:\> md java
3. MISCELLANEOUS COMMANDS
(a) DATE
C:\> Date
To display current date and enter the new date if you want to change
(b)Time
C:\>Time
(c) VERSION
C:\>ver
This command displays the version of MS- DOS you are working upon.
C:\>cls
(e) PATH
C:\>path c:\>java\bin
POST-EXPERIMENT QUESTIONS:
1. What is the purpose of the "dir" command in DOS, and how does it work?
2. How can you create a new directory using the "mkdir" command in DOS? Can you provide an example?
3. What is the purpose of the "cd" command in DOS, and how can you use it to navigate through
directories?
PROGRAM NO-3
PRE-EXPERIMENT QUESTIONS:
read a
read b
read c
then
echo $a is greater
fi
OUTPUT
Enter number1
34
Enter number2
73
Enter number3
44
73 is big
[user9@localhost user9]$
POST-EXPERIMENT QUESTIONS:
PROGRAM NO-4
PRE-EXPERIMENT QUESTIONS:
2. Who will be the intended users of this program? Will it be designed for general users, students, or
specific professionals?
read a
read b
c=`expr $a + $b`
echo addition is $c
OUTPUT
Enter num1
Enter num2
addition is 9
[user9@localhost user9]$
POST-EXPERIMENT QUESTIONS:
1. How did you design and implement the program to find the addition of two numbers?
2. What programming language did you use for the implementation?
3. Did you encounter any challenges or difficulties during the coding process? If so, how did you overcome
them?
PROGRAM NO-5
PRE-EXPERIMENT QUESTIONS:
i=5
echo sequence is
while [ $i != 0 ]
do
echo $i
i=`expr $i - 1`
done
OUTPUT
sequence is
[user9@localhost user9]$
POST-EXPERIMENT QUESTIONS:
PROGRAM NO-6
PRE-EXPERIMENT QUESTIONS:
OUTPUT
[user9@localhost user9]$
POST-EXPERIMENT QUESTIONS:
1. How did you implement the program to retrieve the current date?
2. Did you encounter any challenges while developing the program? If so, what were they, and how did
you overcome them?
3. Is the current date displayed in a specific format? If yes, what format did you choose and why?
PROGRAM NO-7
PRE-EXPERIMENT QUESTIONS:
1. How will the program retrieve and store the biodata? Will it read from a file or a database, or will the
data be hardcoded into the program itself?
2. What format should the biodata be displayed in? Should it be a plain text output, or would you prefer a
formatted layout with headings and sections?
3. Will the program have any filtering or sorting capabilities? For example, can users search for specific
individuals based on criteria like age, education, or skills?
read a
read b
read c
read d
read e
OUTPUT
Seema
20
Mr.Satyapal yadav
Mrs.Sushila yadav
Delhi
your age is 20
[user9@localhost user9]$
POST-EXPERIMENT QUESTIONS:
1. What specific operating system(s) was the program designed to run on?
2. What programming language was used to develop the program?
3. How was the program executed or launched on the operating system?
PROGRAM NO-8
PRE-EXPERIMENT QUESTIONS:
#include<stdio.h>
#include<dirent.h>
*dirp;
exit(1); }
while(dptr=readdir(dirp))
printf(“%s\n”,dptr->d_name);
closedir(dirp);
OUTPUT:
POST-EXPERIMENT QUESTIONS:
1. How does the readdir function relate to the opendir system call?
2. What happens if a directory is modified or deleted while a directory stream is open?
3. Are there any security considerations to keep in mind when using the opendir system call?
PROGRAM NO-9
PRE-EXPERIMENT QUESTIONS:
PROGRAM FOR SYSTEM CALLS OF UNIX OPERATING SYSTEM (fork, getpid, exit)
PROGRAM:
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/types.h>
if (pid == -1) {
exit(1); } if
(pid != 0) {
pid1 = getpid();
} else { pid2
= getpid();
return 0;
OUTPUT:
POST-EXPERIMENT QUESTIONS:
1. What happens when the exit system call is executed? How does it affect the process and the overall
system?
2. Describe the value that is typically returned by a process when it calls the exit system call. What does
this value represent?
3. Can a process exit without calling the exit system call? If so, how does this happen?
PROGRAM NO-10
PRE-EXPERIMENT QUESTIONS:
#include<stdio.h>
#include<stdlib.h>
struct fcfs
{ int pid;
int btime;
int
wtime;
int ttime;
} p[10];int main() { int i,n;
int
towtwtime=0,totttime=0;
printf("\n fcfs scheduling...\n");
printf("enter the no of
process"); scanf("%d",&n);
for(i=0;i<n;i++)
{
p[i].pid=1;
printf("\n burst time of the process”);
scanf("%d",&p[i].btime);
}
p[0].wtime=0;
p[0].ttime=p[0].btime;
totttime+=p[i].ttime;
for(i=0;i<n;i++)
{
p[i].wtime=p[i-1].wtime+p[i-1].btim
p[i].ttime=p[i].wtime+p[i].btime;
totttime+=p[i].ttime;
towtwtime+=p[i].wtime;
}
for(i=0;i<n;i++)
{{
printf("\n waiting time for process”); printf("\n turn around time for process”); printf("\n"); }}
printf("\n total waiting time :%d", totwtime ); printf("\n average waiting
time:%f",(float)totwtime/n); printf("\n total turn around time
:%d",totttime); printf("\n average turn around time:
:%f",(float)totttime/n);
OUTPUT:
POST-EXPERIMENT QUESTIONS:
1. What are the advantages and disadvantages of using the FCFS scheduling algorithm?
2. What are the advantages and disadvantages of using the SJF scheduling algorithm?
3. What are the key data structures and variables required to implement the FCFS scheduling algorithm in a C program?
Crosschecked By
HOD CSE