Last Minute Notes - Operating Systems - GeeksforGeeks
Last Minute Notes - Operating Systems - GeeksforGeeks
65
Aptitude Engineering Mathematics Discrete Mathematics Operating System DBMS Computer Netw
Table of Content
Types of Operating System (OS):
Threads
Process
CPU Scheduling Algorithms
Critical Section Problem
Deadlock
Memory Management
Page Replacement Algorithms
Virtual Memory
File Systems
Disk Scheduling
queue and assigns it to the CPU. This way, the CPU is never kept idle
and the user gets the flavor of getting multiple tasks done at once.
Multi-Tasking/Time-sharing Operating systems: It is a type of
Multiprogramming system with every process running in round
robin manner. Each task is given some time to execute so that all
the tasks work smoothly. Each user gets the time of the CPU as
they use a single system. These systems are also known as
Multitasking Systems. The task can be from a single user or
different users also. The time that each task gets to execute is
called quantum. After this time interval is over OS switches over
to the next task.
3. Multi-Processing Operating System: Multi-Processing Operating
System is a type of Operating System in which more than one CPU is
used for the execution of resources. It betters the throughput of the
System.
4. Multi User Operating Systems: These systems allow multiple users
to be active at the same time. These system can be either
multiprocessor or single processor with interleaving.
5. Distributed Operating System: These types of operating system is a
recent advancement in the world of computer technology and are
being widely accepted all over the world and, that too, at a great
pace. Various autonomous interconnected computers communicate
with each other using a shared communication network. Independent
systems possess their own memory unit and CPU.
6. Network Operating System: These systems run on a server and
provide the capability to manage data, users, groups, security,
applications, and other networking functions. These types of
operating systems allow shared access to files, printers, security,
applications, and other networking functions over a small private
network.
7. Real Time OS – Real-Time OS are usually built for dedicated
systems to accomplish a specific set of tasks within deadlines.
Threads
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 2/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
A thread has its own program counter, register set, and stack
A thread shares resources with other threads of the same process
the code section, the data section, files and signals.
User threads
Kernel threads
Types of Threads
2. Based on level
Process
A process is a program under execution. The value of program counter
(PC) indicates the address of the next instruction of the process being
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 3/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Schedulers
Dispatchers
The dispatcher is responsible for loading the job (selected by the short-
term scheduler) onto the CPU. It performs context switching. Context
switching refers to saving the context of the process which was being
executed by the CPU and loading the context of the new process that is
being scheduled to be executed by the CPU.
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 4/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Arrival Time – Time at which the process arrives in the ready queue.
Completion Time – Time at which process completes its execution.
Burst Time – Time required by a process for CPU execution.
Turn Around Time – Time Difference between completion time and
arrival time.
1. First Come First Serve (FCFS): First Come, First Serve (FCFS) is one
of the simplest types of CPU scheduling algorithms. It is exactly what it
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 5/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
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.
2. Shortest Job First (SJF): Shortest Job First (SJF) or Shortest Job Next
(SJN) is a scheduling process that selects the waiting process with the
smallest execution time to execute next.
It is a non-pre-emptive algorithm.
If all the processes have the same burst times, SJF behaves as FCFS.
In SJF, the burst times of all the processes should be known prior
execution.
It minimizes the average response time of the processes.
There is a chance of starvation.
It is a pre-emptive algorithm.
Processes are assigned to the CPU based on their shortest remaining
burst times.
If all the processes have the same arrival times, SRTF behaves as SJF.
It minimizes the average turnaround time of the processes.
If shorter processes keep on arriving, then the longer processes may
starve.
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 6/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Response Ratio = WT
BT
+BT
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 7/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
1. FCFS can cause long waiting times, especially when the first job
takes too much CPU time.
2. Both SJF and Shortest Remaining time first algorithms may cause
starvation. Consider a situation when a long process is there in the
ready queue and shorter processes keep coming.
3. If time quantum for Round Robin scheduling is very large, then it
behaves same as FCFS scheduling.
4. SJF is optimal in terms of average waiting time for a given set of
processes. SJF gives minimum average waiting time, but problems
with SJF is how to know/predict the time of next job.
A solution for the critical section problem must satisfy the following
three conditions:
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 8/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Deadlock
A situation where a set of processes are blocked because each process
is holding a resource and waiting for another resource acquired by some
other process. Deadlock can arise if following four conditions hold
simultaneously (Necessary Conditions):
Deadlock handling
1. Deadlock prevention
To ensure the system never enters a deadlock state, at least one of the
conditions for deadlock must be prevented:
2. Deadlock Avoidance
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 10/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Banker’s Algorithm
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 11/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Process termination
Resource Pre-emption
4. Deadlock Ignorance
In the Deadlock ignorance method the OS acts like the deadlock never
occurs and completely ignores it even if the deadlock occurs. This
method only applies if the deadlock occurs very rarely. The algorithm is
very simple. It says, ” if the deadlock occurs, simply reboot the system
and act like the deadlock never occurred.” That’s why the algorithm is
called the Ostrich Algorithm.
Memory Management
In multiprogramming system, the task of subdividing the memory
among the various processes is called memory management. The task
of the memory management unit is the efficient utilization of memory
and minimize the internal and external fragmentation.
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 12/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Loading a process into the main memory is done by a loader. There are
two different types of loading :
Dynamic Loading: The entire program and all data of a process must
be in physical memory for the process to execute. So, the size of a
process is limited to the size of physical memory. To gain proper
memory utilization, dynamic loading is used. In dynamic loading, a
routine is not loaded until it is called.
1. First Fit – The arriving process is allotted the first hole of memory in
which it fits completely.
2. Best Fit – The arriving process is allotted the hole of memory in
which it fits the best by leaving the minimum memory empty.
3. Worst Fit – The arriving process is allotted the hole of memory in
which it leaves the maximum gap.
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 13/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Note:
Best fit does not necessarily give the best results for memory
allocation.
The cause of external fragmentation is the condition in Fixed
partitioning and Variable partitioning saying that entire process
should be allocated in a contiguous memory location. Therefore
Paging is used.
Paging
The physical memory is divided into equal sized frames. The main
memory is divided into fixed size pages. The size of a physical memory
frame is equal to the size of a virtual memory frame.
Segmentation
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 14/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
In this algorithm, pages are replaced which are not used for the longest
duration of time in the future.
In this algorithm, the page will be replaced which is least recently used.
Initially, we have 4-page slots empty. Initially, all slots are empty,
so when 7 0 1 2 are allocated to the empty slots —> 4 Page
faults.
0 is already their so —> 0 Page fault.
When 3 came it will take the place of 7 because it is least recently
used —> 1 Page fault.
0 is already in memory so —> 0 Page fault. 4 will takes place of 1
—> 1 Page Fault.
Now for the further page reference string —> 0 Page fault
because they are already available in the memory.
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 16/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
In this algorithm, page will be replaced which has been used recently.
Belady’s anomaly can occur in this algorithm.
Virtual Memory
Virtual memory is a memory management technique used by operating
systems to give the appearance of a large, continuous block of memory
to applications, even if the physical memory (RAM) is limited. It allows
larger applications to run on systems with less RAM.
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 17/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Demand Paging
Thrashing
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 18/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
File Systems
A file system is a method an operating system uses to store, organize,
and manage files and directories on a storage device.
File Directories
Name
Type
Address
Current length
Maximum length
Date last accessed
Date last updated
Owner id
Protection information
Rename a file
Traverse the file system
There are several types of file allocation methods. These are mentioned
below.
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 20/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Disk Scheduling
Disk scheduling algorithms are crucial in managing how data is read
from and written to a computer’s hard disk. These algorithms help
determine the order in which disk read and write requests are
processed, significantly impacting the speed and efficiency of data
access. Common disk scheduling methods include First-Come, First-
Served (FCFS), Shortest Seek Time First (SSTF), SCAN, C-SCAN, LOOK,
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 21/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
FCFS (First Come First Serve): FCFS is the simplest of all Disk
Scheduling Algorithms. In FCFS, the requests are addressed in the
order they arrive in the disk queue.
C-SCAN: In the SCAN algorithm, the disk arm again scans the path
that has been scanned, after reversing its direction. So, it may be
possible that too many requests are waiting at the other end or there
may be zero or few requests pending at the scanned area.
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 22/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
LIFO (Last-In First-Out): In LIFO (Last In, First Out) algorithm, the
newest jobs are serviced before the existing ones i.e. in order of
requests that get serviced the job that is newest or last entered is
serviced first, and then the rest in the same order.
Dreaming of M.Tech in IIT? Get AIR under 100 with our GATE 2026
CSE & DA courses! Get flexible weekday/weekend options, live
mentorship, and mock tests. Access exclusive features like All India
Mock Tests, and Doubt Solving—your GATE success starts now!
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 23/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Similar Reads
Intrusion Detection Systems (IDS) vs Intrusion Prevention Systems…
It is difficult to make Internet use secure in current situation, people are
the among the most important aspect. The two kinds of network securit…
4 min read
6 min read
3 min read
3 min read
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 24/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
For both fixed and dynamic memory allocation schemes, the operating
system must keep a list of each memory location noting which are free…
2 min read
6 min read
4 min read
5 min read
11 min read
Registered Address:
K 061, Tower K, Gulshan Vivante
Apartment, Sector 137, Noida, Gautam
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 25/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Buddh Nagar, Uttar Pradesh, 201305
Advertise with us
Company Explore
About Us Job-A-Thon Hiring Challenge
Legal Hack-A-Thon
Privacy Policy GfG Weekly Contest
Careers Offline Classes (Delhi/NCR)
In Media DSA in JAVA/C++
Contact Us Master System Design
GFG Corporate Solution Master CP
Placement Training Program GeeksforGeeks Videos
Geeks Community
Languages DSA
Python Data Structures
Java Algorithms
C++ DSA for Beginners
PHP Basic DSA Problems
GoLang DSA Roadmap
SQL DSA Interview Questions
R Language Competitive Programming
Android Tutorial
DSA/Placements Development/Testing
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 27/28
2/26/25, 8:26 AM Last Minute Notes – Operating Systems - GeeksforGeeks
Clouds/Devops GATE
DevOps Engineering GATE CS & IT Test Series - 2025
AWS Solutions Architect Certification GATE DA Test Series 2025
Salesforce Certified Administrator Course GATE CS & IT Course - 2025
GATE DA Course 2025
GATE Rank Predictor
https://www.geeksforgeeks.org/last-minute-notes-operating-systems/?ref=lbp 28/28