Introduction
06 July 2026 09:27 PM
Definition :
An Operating System (OS) is system software that acts as an
intermediary between the computer hardware and the user (or
application programs). It manages hardware resources and
provides services for programs to run.
+-------------------------+
| User |
+-------------------------+
↓
+---------------------------------+
| Application Programs |
| (Chrome, VS Code, etc.) |
+---------------------------------+
operating system Page 1
+---------------------------------+
↓
+-----------------------------------+
| Operating System |
| (Windows, Linux, macOS) |
+-----------------------------------+
↓
+-------------------------------+
| Hardware |
| (CPU, RAM, Disk, etc.) |
+-------------------------------+
• Some basic things to know about operating system
1. The OS is stored on the SSD/HDD permanently, but when
the computer starts, it is loaded into RAM.
2. Device controller is a hardware (chip) in the device like
keyboard and mouse
3. Device driver is software that is part of the operating
system (or installed with it).
• Why do we need an OS?
Without an OS:
1. Programs cannot use hardware directly.
2. You cannot easily use the keyboard, monitor, SSD, or
printer.
3. Every application would need to control the hardware itself.
• OS is Software
The operating system:
1. Is written using code (mainly C, C++, and Assembly).
2. Is permanently stored on the SSD/HDD.
3. Is loaded into RAM when the computer starts.
operating system Page 2
Component Purpose
CPU Executes instructions
RAM Temporary working memory
SSD/HDD Permanent storage
• Interrupt
An interrupt is a signal sent to the CPU that says:
"Stop what you're doing for a moment—something needs
your attention."
Example:
• Keyboard key pressed.
• Mouse clicked.
• Data read from SSD completed.
• Process vs Program
A program is a file stored on the SSD.
A process is a program that is currently running.
Example:
• [Link] on the SSD → Program
• Chrome currently running → Process
operating system Page 3
Computer system operation
07 July 2026 07:02 PM
A computer has one or more processors (CPUs).
Examples:
• Laptop → Usually 1 CPU
• Gaming PC → 1 CPU with many cores
• Server → May have 2 or more CPUs
The CPU is the brain that executes instructions.
A computer also contains many device controllers.
Each controller manages a particular type of hardware.
For example:
• Disk Controller → Controls SSD/HDD
• USB Controller → Controls keyboard, mouse, pen drive,
printer
• Video Adapter → Controls the monitor
The bus allows data and instructions to travel between the
CPU, memory, and controllers
operating system Page 4
Storage structure
19 July 2026 09:51 PM
•
• Top → Faster, Smaller, More Expensive
• Bottom → Slower, Larger, Cheaper
1) Register
These are the smallest and fastest memory inside the
CPU.
Registers are very small, extremely fast storage locations
used by the CPU while executing instructions.
A register is located inside the CPU (processor).
2) Cache
Cache is also very fast but slightly slower than registers.
• Located very close to the CPU
• Stores frequently used data
operating system Page 5
• Stores frequently used data
• Reduces the time taken to fetch data from RAM
Example:
Suppose you repeatedly open Chrome.
The operating system keeps some Chrome files in cache
so they load faster next time.
Speed: Very Fast
3) Main memory(RAM)
Main memory is the primary memory of a computer that
stores programs and data currently being used by the
CPU.
• Temporary memory
• Data disappears when power is turned off
• Stores currently running applications
Example : when you open any app like vscode, chrome,
they are loaded into RAM
Real-Life Example
Suppose your laptop has:
• 16 GB RAM
• 512 GB SSD
The SSD permanently stores Windows, games, photos,
and documents.
When you open:
• Windows
• Chrome
• VS Code
• Spotify
they are copied from the SSD into the 16 GB RAM. The
CPU then executes them from RAM. If you open too
many programs and RAM becomes full, the operating
system may temporarily use part of the SSD as virtual
memory (swap/page file), which is much slower than
RAM.
operating system Page 6
4) Electronic Disk (SSD)
This means Solid State Drive (SSD).
• Permanent storage
• Stores Windows, games, videos, photos, code, etc.
• Faster than HDD
• No moving parts
5) Magnetic Disk (HDD)
This is the traditional Hard Disk Drive
• Permanent storage
• Uses spinning magnetic disks
• Slower than SSD
6) Optical Disk
Examples:
• CD
• DVD
• Blu-ray Disc
These are used for
• Movies
• Software installation
• Music
• Backups
Nowadays they are rarely used.
7) Magnetic Tape
This is mainly used in
• Large companies
• Banks
• Data centers
Purpose:
• Long-term backup
• Archive storage
It is very slow, but it can store huge amounts of data at
low cost.
operating system Page 7
low cost.
operating system Page 8
I/O structure
20 July 2026 12:44 AM
A device driver is a special software program that helps the operating system
communicate with a hardware device.
Device Controller
Hardware.
An electronic circuit inside (or attached to) the device.
Its job is to actually control the hardware.
Device Driver Device Controller
Software Hardware
Part of OS Part of device
Translates OS commands Controls actual device
Installed in computer Installed inside hardware
For ex: A mouse has a built-in device controller. When you connect it to a PC, the
operating system loads a device driver (software) that communicates with the mouse's
device controller through the computer's USB/Bluetooth controller.
operating system Page 9
operating system Page 10
Types of computer system architecture
27 July 2026 10:29 AM
• Single-Processor Systems
• Multiprocessor Systems
• Clustered Systems
1. Single-Processor System
• A computer has only one CPU (processor).
• One CPU execute all the task and all program
• If you open chrome ,vscode, and spotify at same time ,
cpu handle all of them by switching between task very
quickly
Advantages
• Cheap
• Simple design
• Easy to maintain
Disadvantages
• If the CPU fails, the computer stops.
• Limited performance.
2. Multiprocessor System
operating system Page 11
Types of operating system
28 July 2026 11:03 PM
Type Definition Main Idea User Main Goal Example
Interaction
Batch Processing OS An operating system that collects similar jobs into a batch and executes them one after another Batch of jobs ❌ No Execute jobs automatically Payroll processing, bill
without user intervention. generation
Multiprogramming OS An operating system that keeps multiple programs in memory and switches the CPU to another Many programs in ❌ Usually Maximize CPU utilization Early mainframe systems
program whenever one is waiting for I/O. memory No
Multitasking (Time- An operating system that allows a single user to run multiple programs simultaneously by giving Many tasks for one ✅ Yes Fast response and better user Windows, Linux, macOS
Sharing) OS each program a small CPU time slice. user experience
Real-Time OS (RTOS) An operating system that responds to events or inputs within a fixed time limit with minimal Immediate response ✅ Yes Meet strict deadlines Airbags, robots, medical
delay. devices
Distributed OS An operating system that manages multiple computers and presents them as a single system to Many computers work ✅ Yes Resource sharing and parallel Google servers, cloud
the user as one processing computing
operating system Page 12
Operating system services
29 July 2026 11:43 PM
1. User interface
The User Interface is the medium through which a user communicates with
the operating system.
Without a UI, the user cannot tell the computer what to do.
• Command line interface(CLI)
Provide text based command to the operating system using keyboerd
in order to perform task by the operating system
For e.g: powershell, terminalm, cmd
• Graphical user interface (GUI)
Uses windows, icons, buttons, and menus.
For eg : window11, macos,
2. Program execution
The OS is responsible for running every program.
3. I/O operating
operating system Page 13
4. File system manipulation
The OS organizes and manages files and folders on storage devices.
Responsibilities
• Create files
• Delete files
• Rename files
• Copy files
• Move files
• Read files
• Write files
• Create folders
• Manage permissions
Without the OS
Files would be scattered randomly across the disk.
Finding them would be nearly impossible.
5. Communication
6. Error detections
7. Resource allocation
Resource is a like memory,cpu,file,input output device
8. Accounting
9. Protection and security
operating system Page 14
User interface (os)
02 August 2026 11:57 PM
operating system Page 15
System call
15 August 2026 01:45 PM
A system call is a mechanism through which a user-level program requests a
service from the OS kernel.
It provides a controlled transition from User Mode to Kernel Mode.
System call = mechanism through which a user program requests a service from
the Operating System.
: when the program swutchesh from user mode to kermal is known as context
switching
User Program
↓
System Call
↓
Kernel Mode
↓
OS Kernel performs operation
↓
Return to User Mode
2. Why are System Calls needed?
User programs run in User Mode, where they have limited privileges.
They cannot directly perform privileged operations such as:
• Accessing hardware
• Managing memory
• Creating processes
• Accessing files
operating system Page 16
• Accessing files
• Controlling I/O devices
The kernel runs in Kernel Mode (privileged mode) and can perform these
operations.
User Mode Kernel Mode
Applications run here OS kernel runs here
Limited privileges High/privileged access
Cannot directly perform privileged Can perform privileged
operations operations
Example: C program Example: Linux kernel
Note by me*
User mode: if the program is executing in user mode then that program does
not have direct access to the memory to hardware
Kernal mode(privileged mode): If the program is running and executing in
kernal mode then that program has direct access to the memory and hardware
and such resources
Problem with kernal mode is , If the program is executing and running in kernal
mode and then if the program crash and anything happen wrong the whole
system crash , and if program crash in user mode is does not crash entire
system
Gpt*
1. User mode
When a normal application runs in user mode:
• It has restricted privileges.
• It cannot directly access hardware or perform privileged operations.
• It generally cannot directly access arbitrary memory belonging to the OS or
other processes.
• If it needs something privileged, it uses a system call to request the OS to
do it.
2. Kernel mode / privileged mode
When the OS kernel is executing in kernel mode:
• It has highly privileged access to hardware and system resources.
• It can manage memory, CPU, devices, files, processes, etc.
• It can execute privileged CPU instructions.
operating system Page 17
• It can execute privileged CPU instructions.
One correction: "a program running in kernel mode" isn't necessarily an
ordinary application. Usually, the kernel and trusted kernel
components/drivers execute there.
3. Why kernel-mode errors are dangerous
Your main idea is correct.
If a bug occurs in kernel-mode code, it can potentially:
• corrupt kernel memory
• corrupt other processes' memory
• cause hardware/device problems
• crash the entire OS
Types of system call
- System call can be grouped into five major category
1. Process control
- End, abort(end the process after completing the process, abort the process
after, hold the process after encounter the error in the process)
- Load, execute(load the process, execute the process)
- Create process, terminate process
- Get process attribute, set process attribute(getting and setting the
attribute)
- Wait for time
- Wait event, signal event
- Allocate and free memory(we allocate the memory to the process, and
when the process is completed ,we deallocate the memory(free))
2. File management/manipulation
- Create file, delete file
- Open close
- Read, write, reposition
- Get file attribute, set file attribute
3. Device management
- Request device, release device
- Read, write, reposition
operating system Page 18
- Read, write, reposition
- Get device attribute, set device attribute
- Logically attach or detech device
4. information maintenance
-
5. Communication
operating system Page 19
System program
15 August 2026 06:25 PM
A system program is a user-level program that provides a convenient environment
for users to interact with and use the operating system.
- System program provide a convenient environment for program development
and execution
- Some of them are simply user interface to system call
- Others are considerable more complex
• System program can be divide into the following categories
1. File management
- Create
- Delete
- Copy
- Rename
- Print
- Dump
- List ,and generally manipulate files and directories
2. Status information
- Date-time
- Amount of available memory or disk space
- Number of users
- Detailed performance
- Logging and debugging information etc
3. Programming -language support
operating system Page 20
4. Program loading and execution
operating system Page 21
OS design and implementation
17 August 2026 09:55 AM
Requirement:
➢ User goals
○ The system should be convenient to use, easy to learn
and use reliable ,safe and fast
➢ System goals
○ The system should be easy to design, implement ,
maintain, operate , it should be flexible , reliable error
free and efficient
Mechanism and policies:
➢ Mechanisms determine how to do something
➢ Policies determine what will be done
Principle:
One important principle is the separation of policy from
mechanism
Implementation:
➢ Once the operating system designed, it must be
implemented.
➢ Traditionally , operating system have been written in
assembly language.
➢ Now, however, they are most commonly written in
higher-level language such as C and C++
Advantages of writing in high level language
➢ The code can be written faster
➢ It is more compact
➢ It is easier to understand and debug
➢ It is easier to port
operating system Page 22
Structure of operating system
17 August 2026 10:21 AM
1. Simple structure
In a simple structure, the OS does not have a clearly
separated structure between its components.
Example: MS-DOS
MS-DOS had a relatively simple structure.
Problem: Because components were not strongly
separated, one part could directly interact with another
part, making the system harder to maintain and protect.
2. Monolithic structure
In a monolithic OS, most OS services run together
operating system Page 23
In a monolithic OS, most OS services run together
inside the kernel.
Traditional UNIX is a classic example of a monolithic-
kernel design.
➢ Advantage
Very fast, because components can communicate
directly.
➢ Disadvantage
The kernel becomes large and complex. A serious bug
in kernel code can potentially affect the whole
system.
➢ Important: Monolithic does NOT mean "one single
program." It means the major OS services operate
together in one large kernel address space.
operating system Page 24
Virtual machine
18 August 2026 09:38 PM
The fundamental idea behind a virtual machine is
to abstract the hardware of a single computer
(the CPU, memory, disk drives, network interface
cards, and so forth) into several different
execution environments, thereby creating the
illusion that each separate execution
environment is running its own private computer.
It is not physically real but we try to make it look
like something like physically real
virtual machine software :- runs in kernal mode
virtual machine itself :- runs in user mode
operating system Page 25
System boot
18 August 2026 10:25 PM
The procedure of staring a computer by loading the kernal is
known as booting the system
On most computer systems, a small piece of code known as
the bootstrap program or bootstrap loader locates the kernel
operating system Page 26
Process and thread
18 August 2026 10:42 PM
process:- A process can be thought of as a program in execution
(A process is a program that is currently running/executing.)
Thread:
A thread is the unit of execution
within a process. A process can have
anywhere from just one thread to
many threads.
A thread is the smallest unit of execution inside a process.
A single process can contain one or multiple threads.
Process state
operating system Page 27
Process control block
Process Control Block (PCB)
A Process Control Block (PCB) is a data structure maintained by the Operating
System for every process.
Simply: PCB is a record/card that contains all important information about a
process.
When a process is created, the OS creates a PCB for it.
Example
Suppose you open Chrome:
Chrome Process
↓
Operating System creates
↓
PCB
Process ID (PID)
Process State
Program Counter
CPU Registers
CPU Scheduling Info
operating system Page 28
CPU Scheduling Info
Memory Info
I/O Status
Important information stored in PCB
1. Process ID (PID)
A unique number used to identify the process.
2. Process State
Tells the current state of the process:
New → Ready → Running → Waiting → Terminated
3. Program Counter (PC)
Stores the address of the next instruction that the process needs to execute.
4. CPU Registers
Stores the current values of CPU registers associated with the process.
5. CPU Scheduling Information
Contains information needed by the scheduler, such as priority and scheduling-
related data.
6. Memory Management Information
Contains information about the memory allocated to the process.
7. I/O Status Information
Contains information about I/O devices and files being used by the process.
operating system Page 29