An operating system(OS) is a program
that manages a computer's hardware and
software, and allows users to interact with the
computer.
It's the most important software that
runs on a computer.
3.
What does anoperating system do?
Manages hardware and software
The OS manages the computer's
memory, processes, and peripheral devices
like printers and disk drives.
Coordinates programs
The OS ensures that all programs
running on the computer have access to the
CPU, memory, and storage they need.
4.
Handles inputand output
The OS handles how data is sent to and
from the computer.
Provides a user interface
The OS allows users to interact with
the computer through a user interface (UI), like
a command-line interface (CLI) or a graphical
user interface (GUI).
5.
some examples ofoperating systems
A popular OS for personal computers and workstations
that's known for its user-friendly interface
Apple's OS that's known for its sleek interface and
integration with other Apple products
An OS for personal computers and
workstations
6.
An OS formobile devices like iPhones and iPads
An OS for mobile devices like phones and tablets
7.
COURSE OBJECTIVES
The facultywill enhance the skills of the students to
Explain the various CPU Scheduling Algorithms.
Demonstrate the concepts of Deadlock Detection Algorithms and
process Synchronization Techniques.
Illustrate the concepts of the divide and conquer and dynamic
programming algorithms.
Familiar with various file allocation strategies.
Elucidate the different backtracking techniques
8.
COURSE OUTCOMES
Upon completionof the course, the students will be able to
CO1: Implement various CPU scheduling algorithms, memory
management techniques, and file allocation strategies to optimize system
performance.
CO2: Analyze different Deadlock Detection and Synchronization
Techniques.
CO3: Design problem solutions adapting divide and conquer and dynamic
programming algorithms.
CO4: Implement file-handling and page replacement Algorithms
CO5: Design problem solutions adapting backtracking techniques.
NAME OF THEEXPERIMENTS
1. SIMULATE THE FOLLOWING CPU SCHEDULING ALGORITHMS.
A) FCFS B) SJF C) ROUND ROBIN D) PRIORITY
2. SIMULATION OF PRODUCER-CONSUMER PROBLEM USING SEMAPHORES.
3. IMPLEMENTATION OF PAGING TECHNIQUE OF MEMORY MANAGEMENT.
4. BANKERS ALGORITHM FOR DEADLOCK AVOIDANCE.
5. IMPLEMENTATION OF DEADLOCK DETECTION ALGORITHM
6. SORT A GIVEN SET OF ELEMENTS USING THE QUICK SORT METHOD AND
DETERMINETHE TIME REQUIRED TO SORT THE ELEMENTS. REPEAT THE
EXPERIMENT FORDIFFERENT VALUES OF N, THE NUMBER OF ELEMENTS IN
THE 1st TO BE SORTED AND PLOT A GRAPH OF THE TIME TAKEN VERSUS N.
THE ELEMENTS CAN BE READ FROM A FILE OR CAN BE GENERATED USING
THE RANDOM NUMBER GENERATOR.
7. IMPLEMENT 0/1 KNAPSACK PROBLEM USING DYNAMIC PROGRAMMING.
8. SIMULATE ALL FILE ALLOCATION STRATEGIES.
A) SEQUENTIAL B) INDEXED C) LINKED
9. IMPLEMENTATION OF PAGE REPLACEMENT ALGORITHMS
A) FIFO B) LRU C) LFU
10. IMPLEMENT N QUEEN'S PROBLEM USING BACK TRACKING.
11.
CONTENT BEYOND SYLLABUS
IMPLEMENTATIONOF C PROGRAM TO
SHOW MULTIPLE THREADS WITH
GLOBAL AND STATIC VARIABLES
VIRTUAL LAB
IMPLEMENTATION OF DISK SCHEDULING
ALGORITHM.
A) FCFS B) SCAN C) C - SCAN
12.
EX: 1 SIMULATETHE FOLLOWING CPU
SCHEDULING ALGORITHMS.
A) FCFS B) SJF C) ROUND ROBIN D) PRIORITY
First Come, First Serve (FCFS) is one of the simplest
types of CPU scheduling algorithms. It is exactly what it
sounds like: processes are attended to in the order in
which they arrive in the ready queue, much like
customers lining up at a grocery store.
FCFS Scheduling is a non-preemptive algorithm,
meaning once a process starts running, it cannot be
stopped until it voluntarily relinquishes the CPU,
typically when it terminates or performs I/O. This method
treats all processes equally, without priority distinctions.
13.
How Does FCFSWork?
The mechanics of FCFS are straightforward:
2. Arrival: Processes enter the system and are
placed in a queue in the order they arrive.
3. Execution: The CPU takes the first process
from the front of the queue, executes it until it
is complete, and then removes it from the
queue.
Repeat: The CPU takes the next process in the
queue and repeats the execution process.
14.
Scenario 1: Processeswith Same Arrival Time
Consider the following table of arrival time and
burst time for three processes P1, P2 and P3
15.
STEP-BY-STEP EXECUTION:
1. P1will start first and run for 5 units of time (from 0 to 5).
2. P2 will start next and run for 3 units of time (from 5 to 8).
3. P3 will run last, executing for 8 units (from 8 to 16).
AT : Arrival Time
BT : Burst Time or CPU Time
TAT : Turn Around Time
WT : Waiting Time
Shortest Job First (SJF) is a CPU scheduling algorithm in operating
systems that selects the process with the smallest burst time for
execution next. It is a non-preemptive scheduling algorithm, although
a preemptive version, known as Shortest Remaining Time First
(SRTF), also exists.
16.
Key Concepts ofSJF:
1. Non-preemptive Scheduling: Once a process starts executing, it runs to
completion.
2. Shortest Burst Time First: The algorithm prioritizes processes with
shorter CPU burst times.
3. Starvation: Longer processes might suffer starvation if shorter processes
keep arriving.
4. Optimal in Theory: SJF is optimal in terms of minimizing the average
waiting time for a set of processes because it executes processes with the
shortest burst time first.
Assume four processes with the following burst times:
17.
Execution Order(Non-preemptive SJF): The processes are sorted
by burst time: P4 → P1 → P3 → P2.
Round Robin (RR) is a preemptive CPU scheduling algorithm
commonly used in operating systems, especially for time-sharing
systems. It ensures fairness by assigning a fixed time slice (also
called a time quantum) to each process in the ready queue,
cycling through them in order.
CPU - - - > Central Processing Unit
AT - - - > Arrival Time
BT - - - > Burst Time
WT - - - > Waiting Time
TAT - - - > Turn Around Time
CT - - - > Completion Time
FIFO - - - > First In First Out
TQ - - - > Time Quantum
18.
Priority Schedulingis a process scheduling algorithm based on priority where the
scheduler selects tasks according to priority. Thus, processes with higher priority
execute first followed by processes with lower priorities.
If two processes have the same priority then scheduling is done on FCFS basis (first
come first serve). Priority Scheduling is of two types : Preemptive and Non-
Preemptive
Preemptive: In this case, resources can be voluntarily snatched.
Non-Preemptive: In this type, if a process is once started, it will execute
completely i.e resources cannot be snatched.
A semaphore is an integer variable, shared among multiple processes. Semaphores
are a tool used in operating systems to help manage how different processes (or
programs) share resources, like memory or data, .The process of using Semaphores
provides two operations:
wait (P): The wait operation decrements the value of the semaphore (entry operation)
signal (V): The signal operation increments the value of the semaphore.(exit
operation)
19.
Types of Semaphores
Semaphores are of two Types:
Binary Semaphore: This is also known as a mutex lock, as they are locks
that provide mutual exclusion. It can have only two values – 0(wait) and
1(signal). Its value is initialized to 1. It is used to implement the solution
of critical section problems with multiple processes and a single resource.
Counting Semaphore: Counting semaphores can be used to control
access to a given resource consisting of a finite number of instances. The
semaphore is initialized to the number of resources available. Increased
1 when resources add and decrease 1 when resources finish its work.
EX:
A printer is a good example. You don't want 2 tasks sending to the printer at
once, so you create a binary semaphore to control printer access. When a
device wishes to print, it attempts to "take" the semaphore. If the semaphore
is available, the task gets to print.
20.
Paging in OS
Paging is a storage mechanism used to retrieve
processes from the secondary storage into the main
memory in the form of pages.
The main idea behind the paging is to divide each
process in the form of pages. The main memory
will also be divided in the form of frames.
One page of the process is to be stored in one of
the frames of the memory. The pages can be stored
at the different locations of the memory but the
priority is always to find the contiguous frames or
holes.
22.
Deadlock Avoidance inOperating Systems
Deadlock occurs in a system when a group of processes are stuck in a state
where each process is waiting for a resource held by another, forming a
circular chain of dependencies. Deadlock avoidance ensures that the system
remains in a safe state and prevents deadlocks by carefully allocating
resources.
Conditions for Deadlock
Deadlock occurs if all the following conditions are true simultaneously:
1. Mutual Exclusion: A resource can only be used by one process at a
time.Multiple processes compete for the same resource
2. Hold and Wait: A process is holding a resource and requesting another
resource that is being held by another process
3. No Preemption: A resource can only be released voluntarily by the
process that is holding it.
4. Circular Wait: A process is waiting for a resource that is being held by
another process, which is waiting for the first process to release the resource
23.
knapsack islike a container or a bag. Suppose
we have given some items which have some
weights or profits. We have to put some items in
the knapsack in such a way total value produces
a maximum profit.
For example, the weight of the container is 20
kg. We have to select the items in such a way
that the sum of the weight of items should be
either smaller than or equal to the weight of the
container, and the profit should be maximum.
24.
File Allocation Methods
Theallocation methods define how the files are
stored in the disk blocks. There are three main
disk space or file allocation methods.
Contiguous Allocation
Paging isa memory management technique used
by operating systems to optimize computer memory usage. It
divides memory into fixed-size pages that are mapped to
physical memory frames, reducing fragmentation and
improving system performance. Paging efficient use of
memory, which is crucial for modern operating systems and
their ability to handle multitasking effectively.
Common Page Replacement Techniques
First In First Out (FIFO)
Optimal Page replacement
Least Recently Used (LRU)
Most Recently Used (MRU)
Backtracking algorithms arelike problem-solving strategies that
help explore different options to find the best solution. They
work by trying out different paths and if one doesn't work, they
backtrack and try another until they find the right one