Operating Systems (CSL303) Lab Manual
Session: 2025-26
Operating Systems Lab Manual
CSL303
Dr. Manvi Breja
Department of Computer Science and Engineering
The Northcap University
Gurugram- 122001, India
Session 2025-26
Operating Systems (CSL303) Lab Manual
Session: 2025-26
Published by:
School of Engineering and Technology
Department of Computer Science & Engineering
The NorthCap University, Gurugram
• Laboratory Manual is for Internal Circulation only
© Copyright Reserved
No part of this Practical Record Book may be
reproduced, used, stored without prior permission of The NorthCap University
Copying or facilitating copying of lab work comes under cheating and is considered as use of unfair
means. Students indulging in copying or facilitating copying shall be awarded zero marks for that
particular experiment. Frequent cases of copying may lead to disciplinary action. Attendance in lab
classes is mandatory.
Labs are open up to 7 PM upon request. Students are encouraged to make full use of labs beyond
normal lab hours.
Operating Systems (CSL303) Lab Manual
Session: 2025-26
PREFACE
Operating System Lab Manual is designed to meet the course and program requirements of NCU
curriculum for [Link] III year students of CSE branch. The concept of the lab work is to give brief
practical experience for basic lab skills to students. It provides the space and scope for self-study so
that students can come up with new and creative ideas.
The Lab manual is written on the basis of “teach yourself pattern” and expected that students who
come with proper preparation should be able to perform the experiments without any difficulty.
Brief introduction to each experiment with information about self-study material is provided. The
laboratory exercises will include familiarization with LINUX system calls for process management
and inter-process communication; Experiments on process scheduling and other operating system
tasks through simulation/implementation. Students would require design process synchronization,
CPU scheduling algorithms, memory management and disc management algorithms in high level
languages like c, c++, python. Finally, the students would require applying the operating system
concepts by experimenting on either xv6/minix operating systems. At the start of each experiment a
question bank for preparation and practice is suggested which may be used to test the basic under-
standing of the students about the experiment. Students are expected to come thoroughly prepared
for the lab. General disciplines, safety guidelines and report writing are also discussed.
The lab manual is a part of curriculum for the TheNorthCap University, Gurugram. Teacher’s copy
of the experimental results and answer for the questions are available as sample guidelines.
We hope that lab manual would be useful to students of CSE, IT, ECE and BSc branches and author
requests the readers to kindly forward their suggestions / constructive criticism for further im-
provement of the work book.
Author expresses deep gratitude to Members, Governing Body-NCU for encouragement and moti-
vation.
Authors
The NorthCap University
Gurugram, India
Operating Systems (CSL303) Lab Manual
Session: 2025-26
CONTENTS
Page
S.N. Details No.
Syllabus
1 Introduction
2 Lab Requirement
3 General Instructions
4 List of Experiments
5 List of Flip Assignment
6 List of Projects
7 Rubrics
8 Annexure 1 (Format of Lab Report)
9 Annexure 2 (Format of Lab Certificate)
Operating Systems (CSL303) Lab Manual
Session: 2025-26
COURSE TEMPLATE
1. Department: Department of Computer Science and Engineering
3. Course Code 4. L-T-P 5. Credits
2. Course Name: Operating System
CSL303 3-0-2 4
6. Type of Course
(Check one): Programme Core ✔ Programme Elective Open Elective
7. Pre-requisite(s), if any: None
8. Frequency of offering (check one): Odd Even Either semester Every semester
9. Brief Syllabus:
This is an introductory course in Operating System concepts that forms an integral part of computer science
engineering in development of software applications in many diverse areas, including Web Development, Windows
Applications, Research, Analytics and Processing. It lays the foundation of Process Management, Scheduling,
Memory Management, Deadlocks and other Operating system concepts.
Total lecture, Tutorial and Practical Hours for this course (Take 15 teaching weeks per semester): 75
Practice
Lectures: 45 hours
Tutorials: 10 hours Lab Work: 20 hours
10. Course Outcomes (COs)
Identify Operating Systems based on their features and functions and them based on modern
CO 1
system and network.
CO 2 Compare and classify Process Scheduling Algorithms with application to real world problems.
CO 3 Discuss and evaluate various Deadlock Avoidance & Recovery techniques.
CO 4 Discuss and assess various Memory Management Techniques and disk scheduling algorithms.
Discuss various Disk management and file allocation methods and select which is suitable in
CO 5
different situations.
11. UNIT WISE DETAILS No. of Units: 5
Unit Number: 1 Title: Introduction to Operating System No. of hours: 6
Content Summary:
Computer system organization/architecture, operating system structure and operations, Types of popular operating
systems, Operating system services, System calls, types of system calls, Modern Operating system: Introduction to
Network OS (Cisco IOS, Windows NT etc.), Real time OS ( Symbian OS, Windows CE etc.), Distributed OS
Operating Systems (CSL303) Lab Manual
Session: 2025-26
(LOCUS, MICROS), Mobile OS (Android, iOS etc. ), IoT/ Embedded device OS (Riot, Android Things, Noobs etc.)
and Cloud OS(Cloud Me, Condor etc., Linux commands: File Management, Directory management, File
permission/access modes, Process management, shell and its type, Shell Programming (Basic operations,
Decision making and loops, and Regular expressions) .
Unit Number: 2 Title: Process Management and CPU scheduling No. of hours: 10
Content Summary:
Process Concept, Operations on Process, Inter-process Communication, Process Scheduling- Basic Concepts,
Scheduling Algorithms- FIFO, SJF/ Priority, Round Robin, Multilevel Approaches, Multithreading Models,
Multiprocessor, Real Time Scheduling, Earliest-Deadline-First Scheduling, Proportional Share and pthreads
Scheduling .
Unit Number: 3 Title: Process Synchronization and Deadlock No. of hours: 11
Content Summary:
Process Synchronization: Background, The Critical-Section Problem, Synchronization Hardware, Mutex Locks,
Semaphores, Classic Problems of Synchronization, Monitors, System model, deadlock characterization, Methods
for handling deadlocks, Deadlock prevention techniques, Deadlock avoidance algorithms (Banker's algorithm),
Deadlock detection and Recovery from deadlocks
Unit Number: 4 Title: Memory Management (Main and Virtual memory) No. of hours: 10
Content Summary:
Main memory basic hardware and the concept of address binding, Logical vs. Physical address space, Dynamic
loading and linking, shared libraries, Swapping, Contiguous memory allocation, Segmentation, Paging, shared
pages, Virtual memory and virtual address space, Demand paging, Page Replacement and Page replacement
policies (FIFO, Optimal, LRU, LRU page approximation, Counting based page replacement), Thrashing and
working set model.
Unit Number: 5 Title: Storage Management and File structure No. of hours: 8
Content Summary:
Disk structure, Disk scheduling algorithms (FCFS, SSTF, SCAN, C-SCAN and LOOK etc.), File and its types,
Allocation methods (Contiguous, Linked, Indexed) and Free space management
12. Brief Description of Self-learning components by students (through books/resource material etc.):
● [Link]
system-engineering-fall-2012/
● [Link]
GATE/NET/other Exams
1. Operating System | CSE (Computer Science) - [Link]
2. Operating System Multiple choice Questions and Answers-GATE cse question paper ([Link])
Operating Systems (CSL303) Lab Manual
Session: 2025-26
● Advanced Learning Components
● Advanced Operating Systems | Department of Computer Science ([Link])
Certification courses/programs for Skill Development
● [Link]
● [Link]
● Books Recommended:
Textbooks:
● Abraham Silberschatz , Peter B Galvin and Gerg Gagne, Operating system concepts, 9th ed, WILEY,
2018
Reference Books:
● Andrew S. Tanenbaum and Herbert Bos, Modern Operating Systems, 4th ed., Pearson, 2016.
● Sumitabha Das, UNIX concepts and applications, 4th ed., Tata McGraw Hill, 2017.
Reference Websites: (nptel, swayam, coursera, edx, udemy, lms, official documentation weblink)
● [Link]
● Course Modules: (Cintana) SER 334: Operating Systems and Networks ([Link])
● [Link]
● [Link]
● [Link]
Operating Systems (CSL303) Lab Manual
Session: 2025-26
1. INTRODUCTION
That ‘learning is a continuous process’ cannot be over emphasized. The theoretical knowledge
gained during lecture sessions need to be strengthened through practical experimentation. Thus
practical makes an integral part of a learning process.
The purpose of conducting experiments can be stated as follows:
To familiarize the students with the basic concepts, programming skill development and
the take home laboratory assignments mainly implementation-oriented which have to be
coded in high level language. The lab sessions will be based on exploring the concepts
discussed in class.
Observing basic structure and characteristics of Operating Systems
Reporting and analyzing the complexities.
Hands on experience on the experimental setup and software tools
2. LAB REQUIREMENTS
[Link]. Requirements Details
1 Software Requirements Linux’s Shell, Python/c/c++
2 Operating System Linux Operating System
3 Hardware Requirements Windows and Linux: Intel 64/32 or
AMD Athlon 64/32, or AMD Opteron
proces- sor
2 GB RAM
80 GB hard disk space
4 Required Bandwidth NA
Operating Systems (CSL303) Lab Manual
Session: 2025-26
3. GENERAL INSTRUCTIONS
1. General discipline in the lab
Students must turn up in time and contact concerned faculty for the experiment they are
supposed to perform.
Students will not be allowed to enter late in the lab.
Students will not leave the class till the period is over.
Students should come prepared for their experiment.
Experimental results should be entered in the lab report format and certified/signed by
concerned faculty/ lab Instructor.
Students must get the connection of the hardware setup verified before switching on the
power supply.
Students should maintain silence while performing the experiments. If any necessity
arises for discussion amongst them, they should discuss with a very low pitch without
disturbing the adjacent groups.
Violating the above code of conduct may attract disciplinary action.
Damaging lab equipment or removing any component from the lab may invite penalties
and strict disciplinary action.
2. Attendance
Attendance in the lab class is compulsory.
Students should not attend a different lab group/section other than the one assigned at
the beginning of the session.
On account of illness or some family problems, if a student misses his/her lab classes,
he/she may be assigned a different group to make up the losses in consultation with the
concerned faculty / lab instructor. Or he/she may work in the lab during spare/extra
hours to complete the experiment. No attendance will be granted for such case.
3. Preparation and Performance
Students should come to the lab thoroughly prepared on the experiments they are as-
signed to perform on that day. Brief introduction to each experiment with information
about self study reference is provided on LMS.
Students must bring the lab report during each practical class with written records of
the last experiments performed complete in all respect.
Each student is required to write a complete report of the experiment he has performed
and bring to lab class for evaluation in the next working lab. Sufficient space in work
book is provided for independent writing of theory, observation, calculation and con-
clusion.
Students should follow the Zero tolerance policy for copying / plagiarism. Zero marks
will be awarded if found copied. If caught further, it will lead to disciplinary action.
Refer Annexure 1 for Lab Report Format
Operating Systems (CSL303) Lab Manual
Session: 2025-26
4. LIST OF EXPERIMENTS
Exp. Division of List of Experiments
No. Experiments
1 Basics of Linux To familiarize the students to Linux interface and install Linux.
2 To write the shell programming code for the following.
a) Write A Shell Program of Hello World
b) Write a shell program to find factorial of a number.
c) Write a shell program to find gross salary of an employee.
d) Write a shell program to display the menu and execute instructions
Shell Programs
accordingly
(i)List of files (ii)Process Status (iii) Date (iv) users in program (v) Quit
3 To write the shell programming code for the following.
a) Write a shell program to find Fibonacci series.
b) Write a shell program to find largest of three numbers.
c) Write a shell program to find average of N numbers
4 To write the shell programming code for the following.
a) Write a shell program to check whether a number is even or odd
b) Write a shell program to find whether a number is prime or not.
c) Write a shell program to find whether a number is palindrome or not.
d) Write a shell program to type number 1 to 7 and then print its corresponding
day of week
5 Implement the following CPU scheduling Algorithms.
i) FCFS with Arrival time
ii) FCFS without Arrival time
6 Implement the following CPU scheduling Algorithms.
CPU scheduling
SJF (Non-Preemptive)
algorithms
SJTF (shortest remaining time first -Preemptive SJF)
7
Implement the priority scheduling.
8
Implement the Round Robin scheduling.
9
Synchronization Write a program to implement reader/writer problem using semaphores.
10 algorithms Write a program to implement Dining Philosopher’s problem using semaphores.
11 Deadlock
Management Write a program to implement Banker’s algorithm for deadlock avoidance.
Technique
12 Page Replacement Write a program for page replacement policy using a) LRU b) FIFO c)
Algorithms Optimal.
5. LIST OF FLIP EXPERIMENTS
1. Execute the who command written in a file to instruct the shell to read input from
a file called "myfile1" instead of from the keyboard. Use the more command to
see the con- tents of myfile1.
2. Use the date and who commands in sequence (in one line) such that the output
of date will display on the screen and the output of who will be redirected to a
file called my- file2. Use the more command to check the contents of myfile2
3. Write a sed command that swaps the first and second words in each line in a file.
4. Write a shell script that takes a command –line argument and reports on whether
it is di- rectory, a file, or something else.
5. Write a shell script that accepts one or more file name as arguments and
converts all of them to uppercase, provided they exist in the current directory.
6. Write a shell script that determines the period for which a specified user is
working on the system.
7. Write a shell script that accepts a file name, starting and ending line numbers
as argu- ments and displays all the lines between the given line numbers.
8. Write a shell script that deletes all lines containing a specified word in one or
more files supplied as arguments to it.
9. Write a shell script to perform the following string operations:
i. To extract a sub-string from a given string
ii. To find the length of a given string
6. LIST OF PROJECTS
Case Study of Window OS
Case Study of Linux OS
Case Study of MAC OS
7. RUBRICS
xii
Operating Systems (CSL303)
Lab Workbook
Sessi
on: 2023-24
Marks Distribution
Continuous Evaluation(50 Marks) End Semester Exam (20 Marks)
Each experiment shall be evaluated for 10 End semester practical evaluation includ-
marks and at the end of the semester propor- ing Mini project (if any) carries 20 marks.
tional marks shall be awarded out of 50.
Following is the breakup of 10 marks for
each
4 Marks: Observation & conduct of experi-
ment. Teacher may ask questions about ex-
periment.
3 Marks: For report writing
3 Marks: For the 15 minutes quiz to be conduct-
ed in every lab.
INDEX
S. Experiment Date of Date of CO Signature
No Experiment Submission Covered
xiii
To familiarize the students to Linux interface
1
and install Linux.
Operating Systems (CSL303)
To write
Lab the shell programming code for the
Workbook
following. Sessi
a) Write A Shell Program of Hello World on: 2023-24
b) Write a shell program to find factorial of a
number.
2 c) Write a shell program to find gross salary of
an employee.
d) Write a shell program to display the menu
and execute instructions accordingly
(i)List of files (ii)Process Status (iii) Date (iv)
users in program (v) Quit
To write the shell programming code for the
following.
a) Write a shell program to find Fibonacci
series.
3
b) Write a shell program to find largest of three
numbers.
c) Write a shell program to find average of N
numbers
To write the shell programming code for the
following.
a) Write a shell program to check whether a
number is even or odd
b) Write a shell program to find whether a
4
number is prime or not.
c) Write a shell program to find whether a
number is palindrome or not.
d) Write a shell program to type number 1 to 7
and then print its corresponding day of week
Implement the following CPU scheduling
Algorithms.
5
i) FCFS with Arrival time
ii) FCFS without Arrival time
Implement the following CPU scheduling
Algorithms.
6 SJF (Non-Preemptive)
SJTF (shortest remaining time first -
Preemptive SJF)
7 Implement the priority scheduling.
8 Implement the Round Robin scheduling.
xiv
Operating Systems (CSL303)
Lab Workbook
Sessi
on: 2023-24
Experiment No: 1
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Marks:
Objective(s):
To familiarize the students to Linux interface.
Outcome:
The students will understand commands used in Linux.
Problem Statement:
Implement the following things:
Linux Installation
xv
Operating Systems (CSL303)
Lab Workbook
Sessi
on: 2023-24
Background Study:
Cygwin is a open source tool which provides that functionality of the Linux in windows Operating
System. Cygwin is a large collection of GNU and Open Source tools which provide functionality similar to
a Linux distribution on Windows. It is a DLL ([Link]) which provides substantial POSIX API
functionality.
Question Bank:
1. What is Linux?
2. How will you List files from a directory?
3. How files in a directory can be removed?
4. How to find out a word in a file?
5. What are wildcards?
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs
xvi
Operating Systems (CSL303)
Lab Workbook
Sessi
on: 2023-24
Experiment No: 2
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
xvii
Operating Systems (CSL303)
Lab Workbook
Sessi
on: 2023-24
Marks:
Objective(s):
To write the shell programming code for the following.
Outcome:
Student is able to write code in shell programming.
Problem Statement:
a) Write A Shell Program of Hello World
b) Write a shell program to find factorial of a number.
c) Write a shell program to find gross salary of an employee.
d) Write a shell program to display the menu and execute instructions accordingly
(i)List of files (ii)Process Status (iii) Date (iv) users in program (v) Quit
Background Study:
A shell script is a file with a set of commands in it. The shell reads this file and executes the
instructions as if they were input directly on the command line.
A shell is a command-line interpreter and operations such as file manipulation, program execution
and text printing are performed by shell script. So, we will use vi editor to edit our files.
Question Bank:
1. What is a shell?
2. What is the significance of $#?
3. What are the different types of commonly used shells on a typical Linux system?
4. How will you pass and access arguments to a script in Linux?
xviii
Operating Systems (CSL303)
Lab Workbook
Sessi
on: 2023-24
5. Use sed command to replace the content of the file (emulate tac command)
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs
EXPERIMENT NO. 3
Student Name and Roll Number:
xix
Operating Systems (CSL303)
Lab Workbook
Sessi
on: 2023-24
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Marks:
Objective:
To write the shell programming code for the following.
Outcome:
Student is able to write code in shell programming
Problem Statement:
a) Write a shell program to find Fibonacci series.
b) Write a shell program to find largest of three numbers.
c) Write a shell program to find average of N numbers
Background Study:
A shell script is a file with a set of commands in it. The shell reads this file and executes the
instructions as if they were input directly on the command line.
A shell is a command-line interpreter and operations such as file manipulation, program execution
and text printing are performed by shell script. So, we will use vi editor to edit our files.
Question Bank:
1. How to use multi line comments in shell script?
2. What is the difference between soft and hard links?
xx
Operating Systems (CSL303)
Lab Workbook
Sessi
on: 2023-24
3. Explain about loops and what are the loops available in LINUX?
4. What are absolute and relative paths.
5. How to debug a shell script.
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs
EXPERIMENT NO. 4
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Marks:
Objective:
To write the shell programming code for the following.
Outcome:
Student is able to write code in shell programming
Problem Statement:
a) Write a shell program to check whether a number is even or odd
b) Write a shell program to find whether a number is prime or not.
c) Write a shell program to find whether a number is palindrome or not.
d) Write a shell program to type number 1 to 7 and then print its corresponding day of week
Background Study:
A shell script is a file with a set of commands in it. The shell reads this file and executes the
instructions as if they were input directly on the command line.
A shell is a command-line interpreter and operations such as file manipulation, program execution
and text printing is performed by shell script. So, we will use vi editor to edit our files.
Question Bank:
1. What are Zoombie Process?
2. What are different types of variables used in shell script?
3. What are the different types of modes available in Vi editor?
xxii
Operating Systems
(CSL303) Lab Workbook
Session: 2022-23
4. What are the different types of permission at file level in shell?
5. How to use comments in shell script.
Student Work Area
Algorithm/Flowchart/Code/Sample output
Experiment No: 5
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Marks:
Objective:
Write a program to implement CPU scheduling for first come first serve approach.
Outcome:
The students will understand the First-cum-first-serve algorithm
Problem Statement:
Implement the following CPU scheduling Algorithms.
i) FCFS with Arrival time
ii) FCFS without Arrival time
Background Study:
FCFS
• The simplest CPU-scheduling algorithm is the first-come, first-served (FCFS) scheduling
algorithm. With this algorithm, processes are assigned the CPU in the order they request it.
• There is a single queue of ready processes.
• The implementation of the FCFS policy is easily managed with a FIFO queue. When a process
enters the ready queue, its PCB is linked onto the tail of the queue.
• The average waiting time under the FCFS policy, however, is often quite long.
Question Bank:
1. Which module gives control of the CPU to the process selected by the short-term scheduler?
a) dispatcher
b) interrupt
c) scheduler
d) none of the mentioned
2. The processes that are residing in main memory and are ready and waiting to execute are kept on a list
called
xxiv
xxiv
Operating Systems
(CSL303) Lab Manual
Session: 2023-24
a) job queue
b) ready queue
c) execution queue
d) process queue
3. The interval from the time of submission of a process to the time of completion is termed as
a) waiting time
b) turnaround time
c) response time
d) throughput
4. Which scheduling algorithm allocates the CPU first to the process that requests the CPU first?
a) first-come, first-served scheduling
b) shortest job scheduling
c) priority scheduling
d) none of the mentioned
5. In priority scheduling algorithm
a) CPU is allocated to the process with highest priority
b) CPU is allocated to the process with lowest priority
c) equal priority processes cannot be scheduled
d) none of the mentioned
xxv
xxv
Operating Systems
(CSL303) Lab Manual
Session: 2023-24
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs
xxvi
xxvi
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
Experiment No: 6
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Marks:
Objective:
Write a program to implement CPU scheduling for shortest job first (Preemptive and Non-Preemptive)
Outcome:
The students will understand the Shortest Job First scheduling mechanism
Problem Statement:
Implement the following CPU scheduling Algorithms.
SJF (Non-Preemptive)
SJTF (shortest remaining time first -Preemptive SJF)
Background Study:
Shortest Job first is having the advantage of a minimum average waiting time .
This algorithm associates with each process the length of the process next burst [Link]
CPU is available it assigned to the process that has the smallest next CPU burst [Link]
CPU burst time of two process is same then it follows FCFS.
It may cause starvation if shorter processes keep coming. This problem can be solved using
the concept of ageing.
It is practically infeasible as Operating System may not know burst time and therefore may
not sort them.
Question Bank:
1. scheduling algorithm In multilevel feedback
A. processes are not classified into groups
B. a process can move to a different classified ready queue…
C. classification of the ready queue is permanent
D. none of the mentioned
2. Select one which algorithms tend to minimize the process flow time?
A. First come First served
B. Earliest Deadline First
C. Shortest Job First
xxvii
xxvii
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
D. Longest Job First
3. The process can be classified into many groups in
A. shortest job scheduling algorithm
B. multilevel queue scheduling algorithm
C. round-robin scheduling algorithm
D. priority scheduling algorithm
4. The turnaround time for short jobs during multiprogramming is usually Shortened and that
for long jobs is slightly ___________
A. Shortened
B. Unchanged
C. Lengthened
D. Shortened
5. Time quantum can be said
A. multilevel queue scheduling algorithm
B. round-robin scheduling algorithm
C. shortest job scheduling algorithm
D. priority scheduling algorithm
xxviii
xxvii
i
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs
xxix
xxix
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
Experiment No: 7
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Marks:
Objective:
Write a program to perform priority scheduling among a set of processes.
Outcome:
Student will understand the working of priority scheduling among a set of processes.
Problem Statement:
Implement the priority scheduling.
Background Study:
Priority scheduling is a non-preemptive algorithm and used in batch systems. Each process is assigned a
priority. Process with highest priority is to be executed first and so on.
Question Bank:
1. What are advantages of Priority scheduling?
2. What are disadvantages of priority scheduling?
3. At the ready queue when a process arrives In priority scheduling algorithm, the priority of this
process is compared with the priority of?
A. currently running process
B. parent process
C. all process
D. init process
xxx
xxx
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
4. Differentiate between pre-emptive and non pre-emptive scheduling?
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs
xxxi
xxxi
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
Experiment No: 8
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Marks:
Objective: Objective
To familiarize the students about CPU scheduling Algorithms
Program Outcome
The students will understand the Round Robin Algorithm.
Problem Statement:
Implement the Round Robin Algorithm.
Background Study:
In Round Robin each process is assigned a fixed time slot in a cyclic way and this is preemptive. It
has a disadvantage of context switch and have quantum time
Question Bank:
xxxii
xxxii
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
1. What is Preemptive and Non- Preemptive CPU scheduling? Explain with examples.
2. Explain the difference between short term, long term and medium term scheduling.
3. Explain the function of Dispatcher and Context Switch mechanism.
4. What are the advantages and disadvantages of Round robin?
5. Give the application are of Robin Robin.
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs
xxxiii
xxxii
i
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
Experiment No: 9
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Marks:
Objective: Write a program to implement reader/writer problem using semaphore
Program Outcome
The students will understand the reader/writer problem using semaphore
Problem Statement:
Write a program to implement reader/writer problem using semaphore
Background Study: There is a shared resource which should be accessed by multiple processes. There are
two types of processes in this context. They are reader and writer. Any number of readers can read from the
shared resource simultaneously, but only one writer can write to the shared resource. When a writer is
writing data to the resource, no other process can access the resource. A writer cannot write to the resource if
xxxiv
xxxi
v
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
there are non-zero number of readers accessing the resource at that time.
Question Bank:
1. An un-interruptible unit is known as ____________
a) single
b) atomic
c) static
d) none of the mentioned
2. TestAndSet instruction is executed ____________
a) after a particular process
b) periodically
c) atomically
d) none of the mentioned
3. Semaphore is a/an _______ to solve the critical section problem.
a) hardware for a system
b) special program for a system
c) integer variable
d) none of the mentioned
4. What are the two atomic operations permissible on semaphores?
a) wait
b) stop
c) hold
d) none of the mentioned
5. When several processes access the same data concurrently and the outcome of the execution
depends on the particular order in which the access takes place is called ________
a) dynamic condition
b) race condition
c) essential condition
d) critical condition
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs
xxxv
xxxv
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
Experiment No: 10
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Marks:
Objective:
Write a program to implement Dining Philosopher’s problem using semaphore
Outcome:
xxxvi
xxxv
i
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
The students will understand the problem of synchronization among processes and its solution through
Dining Philosopher’s problem using semaphore
Problem Statement:
Write a program to implement Dining Philosopher’s problem using semaphore
Background Study:
Five philosophers, spend their time thinking and eating spaghetti. They eat at a round table with five individual
seats. For eating each philosopher needs two forks (the resources). There are five forks on the table, one left
and one right of each seat. When a philosopher cannot grab both forks it sits and waits. Eating takes random
time, then the philosopher puts the forks down and leaves the dining room. After spending some random time
thinking he again becomes hungry, and the circle repeats itself.
Question Bank:
1. Which one of the following is a synchronization tool?
a) thread
b) pipe
c) semaphore
d) socket
2. A semaphore is a shared integer variable __________
a) that can not drop below zero
b) that can not be more than zero
c) that can not drop below one
d) that can not be more than one
3. The bounded buffer problem is also known as ____________
a) Readers – Writers problem
b) Dining – Philosophers problem
c) Producer – Consumer problem
d) None of the mentioned
4. In the bounded buffer problem ____________
a) there is only one buffer
b) there are n buffers ( n being greater than one but finite)
c) there are infinite buffers
d) the buffer size is bounded
5. To ensure difficulties do not arise in the readers – writers problem _______ are given exclusive
access to the shared object.
a) readers
b) writers
c) readers and writers
d) none of the mentioned
xxxvi
xxxv i
ii
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs
Experiment No:11
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
Marks:
xxxvi
xxxv ii
iii
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
Objective:
Write a program to implement Banker’s algorithm for deadlock avoidance.
Outcome:
The students will understand how system handles deadlock using Banker’s algorithm for deadlock avoidance
Problem Statement:
Write a program to implement Banker’s algorithm for deadlock avoidance.
Background Study:
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.
Banker’s algorithm is named so because it is used in banking system to check whether loan can be sanctioned
to a person or not. Suppose there are n number of account holders in a bank and the total sum of their money is
S. If a person applies for a loan then the bank first subtracts the loan amount from the total money that bank has
and if the remaining amount is greater than S then only the loan is sanctioned. It is done because if all the
account holders comes to withdraw their money then the bank can easily do it.
Question Bank:
1. Each request requires that the system consider the _____________ to decide whether the
current request can be satisfied or must wait to avoid a future possible deadlock.
a) resources currently available
b) processes that have previously been in the system
c) resources currently allocated to each process
d) future requests and releases of each process
2. Given a priori information about the ________ number of resources of each type that maybe
requested for each process, it is possible to construct an algorithm that ensures that the
system will never enter a deadlock state.
a) minimum
b) average
c) maximum
d) approximate
3. A deadlock avoidance algorithm dynamically examines the __________ to ensure that a
circular wait condition can never exist.
a) resource allocation state
b) system storage state
c) operating system
d) resources
4. A state is safe, if ____________
a) the system does not crash due to deadlock occurrence
b) the system can allocate resources to each process in some order and still avoid a deadlock
xxxix
xxxi
x
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
c) the state keeps the system protected and safe
d) all of the mentioned
5. The two ways of aborting processes and eliminating deadlocks are ____________
a) Abort all deadlocked processes
b) Abort all processes
c) Abort one process at a time until the deadlock cycle is eliminated
d) All of the mentioned
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs
Experiment No: 12
Student Name and Roll Number:
Semester /Section:
Link to Code:
Date:
Faculty Signature:
xl
xl
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
Marks:
Objective:
Write a program for page replacement policy using a) LRU b) FIFO c) Optimal.
Outcome:
The students will understand concept of memory management through various page replacement policy
using a) LRU b) FIFO
Problem Statement:
Write a program to implement page replacement policy using a) LRU b) FIFO c) Optimal.
Background Study:
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. Different
page replacement algorithms suggest different ways to decide which page to replace. The
target for all algorithms is to reduce number of page faults.
Question Bank:
1. The main memory accommodates ____________
a) operating system
b) cpu
c) user processes
d) all of the mentioned
2. What is the operating system?
a) in the low memory
b) in the high memory
c) either low or high memory (depending on the location of interrupt vector)
d) none of the mentioned
3. In contiguous memory allocation ____________
a) each process is contained in a single contiguous section of memory
b) all processes are contained in a single contiguous section of memory
c) the memory space is contiguous
d) none of the mentioned
4. The relocation register helps in ____________
a) providing more address space to processes
b) a different address space to processes
xli
xli
Operating
Systems (CSL303) Lab Manual
Session: 2023-24
c) to protect the address spaces of processes
d) none of the mentioned
5. With relocation and limit registers, each logical address must be _______ the limit register.
a) less than
b) equal to
c) greater than
d) none of the mentioned
Student Work Area
Algorithm/Flowchart/Code/Sample Outputs