OS SLIDES SUMMARY
OS SLIDES SUMMARY
OS is a resource manager.
Manages:
o CPU
o Memory
o Storage
o Input/Output Devices
o Files
A system has:
Startup process:
2. Sets up system.
CPU:
1. Pauses
If CPU state changes, it's saved & restored for smooth continuation
💾 Storage Structure
Execution cycle:
Fetch ➝ Decode ➝ Execute ➝ Store result
Main Memory:
🔌 I/O Structure
✅ For large data: DMA (Direct Memory Access) handles block transfers with less CPU work
1. Hardware:
2. Operating System:
o Coordinates hardware
3. Application Programs:
4. Users:
Component Function
1. User View
2. System View
OS = resource manager
LECTURE 2&3
Batch System
Multiprogrammed System
Real-Time System
👤 Single User Systems
o Easy to use
🔁 Multiprogrammed System
🔹 How It Works:
Multiple jobs stored in memory
o Memory is freed
Used in:
o Scientific labs
o Medical systems
o Industrial machines
o Displays
LECTURE 4
The OS is designed to manage computer resources and ensure smooth functioning. Key
functions include:
1. Memory Management
2. Processor Management
3. Device Management
4. File Management
5. Security
🧠 Memory Management
In multiprogramming, decides:
Processor Management
💽 Device Management
Determines:
📁 File Management
Job Accounting: Logs how much time and resources each job/user consumes.
Error Detection:
Software Coordination:
LECTURE 5
Batch Interface:
Commands are written in a file and run automatically.
Example: A backup.bat file copies documents to a folder daily without user action.
3. I/O Operations
Programs can:
OS manages file permissions to protect data. Example: Set a file so only you can open it.
🔄 5. Communications
❗ 6. Error Detection
Takes actions like showing error messages or stopping faulty programs. Example: If a
printer runs out of paper, OS alerts the user.
⚖️Resource Allocation
Uses techniques like CPU scheduling. Example: Running Word and Spotify at the same
time – OS balances both.
📊 Accounting
o Used for billing or analyzing usage. Example: In a shared system, OS logs who
used how much CPU/storage.
🔐 Protection and Security
Security: Defends against external threats (e.g., hackers). Example: OS uses passwords
and monitors for suspicious activity.
LECTURE 6A
o Bourne Shell
o C Shell
o Korn Shell
✅ Most commands are external programs, not part of the shell itself.
💡 Example:
When you type rm file.txt, the shell:
🛠 This setup lets users add new commands easily by writing new programs.
Graphical User Interface (GUI)
First popular on Apple Macintosh (1980s) and Windows (MS-DOS with GUI).
o CDE
o X-Windows
o KDE
📌 Note: UI is separate from the OS's core – making the interface "user-friendly" is not the OS's
primary job.
⚙️System Calls
System calls = The way programs request services from the OS.
7. Terminate program
Windows API
Java API
📦 Example:
CreateProcess() (Windows API) → Internally calls NTCreateProcess() in the kernel.
System-call interface maps API calls to the correct system call using a unique ID.
File name
Memory address
Buffer size
1. Registers
2. Memory block/table
3. Stack
LECTURE 6B
A system call is a programmatic way for a program to request a service from the operating
system’s kernel.
2. Read input from keyboard (file names) → System call for input
🔁 Reading/writing files
📁 Creating/deleting files
👶 Creating/managing processes
🌐 Network communications
Manage processes.
Functions:
wait, signal
end, abort
Functions:
Create/delete/open/close file
Read/write/reposition
Functions:
Request/release device
Attach/detach device
Get/set device attributes
Functions:
5️⃣ Communication
Functions:
Send/receive messages
o Registers
o Stacks
Call Function
LECTURE 9
PROCESS
When you write a program (like in a text file) and then run it—that running version is
the process.
4. Waiting – Waiting for some resource (e.g., user input or file access).
THREAD
Example:
Watching a video while it's still downloading – both actions happen together using
threads.
LECTURE 10
1. What is a Process?
It includes:
2. Process ≠ Program
3. Example:
Two users running the same web browser = two separate processes.
4. Process States
State
Program Counter
CPU Registers
6. Threads
7. Process Scheduling
8. Schedulers
9. Context Switch
Saves the state of the current process in its PCB and loads the next one.
Information sharing
Modularity
User convenience
IPC Models:
Buffer Types:
LECTURE 11
What is it?
It's about managing access to shared resources when multiple processes run at the
same time.
Prevents data inconsistency when two or more processes access shared data.
Problem:
Goal: Make sure Producer doesn't add when the buffer is full, and Consumer doesn’t
remove when it's empty.
They can run at the same time, but must coordinate access:
1. Unbounded Buffer
o No size limit.
2. Bounded Buffer
o Fixed size.
Use an integer count to track how many items are in the buffer.
Initially: count = 0
Race Condition
When multiple processes access and modify shared data at the same time.
A critical section is the part of a program where shared resources are accessed.
1. Mutual Exclusion:
o If no process is in the critical section, one that wants to enter should not wait
forever.
3. Bounded Waiting:
o A process waiting to enter must eventually get its turn—no infinite waiting.
👉 Assumes each process runs at nonzero speed, but we don’t assume which one is faster.
Peterson’s Solution
Uses shared variables and assumes atomic (uninterruptible) instructions like LOAD and
STORE.
LECTURE 12
🔐 Mutex Lock
Used to allow multiple threads to share a resource, but not at the same time.
How it works:
⚙️Mutex Logic
Two types:
🔄 Operations
❌ Deadlocks
🧠 Background
📌 What is Deadlock?
Several processes are stuck waiting forever on each other for resources.
💾 Examples of Resources:
2. Use it.
3. Release it.
🧩 Example
🚗 Bridge Example
One-way bridge → each car = process, each section = resource.
🔍 Deadlock Characterization
A deadlock occurs only when all these four conditions are true:
Nodes:
o Circles: Processes
🔁 Types of Edges
🔄 Edge Behavior
🌀 Deadlock in RAG
No cycles: No deadlock.
📊 Summary
No cycles ⇒ No deadlock
Cycle exists ⇒