0% found this document useful (0 votes)
0 views

Operating System ka Overview

The document provides an overview of Operating Systems (OS), detailing their functions, types, and importance, along with a focus on UNIX/Linux architecture. It explains core components such as the kernel, shell, and application layers, as well as process and memory management concepts. Additionally, it discusses process scheduling, multithreading, and memory management techniques like paging and virtual memory.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Operating System ka Overview

The document provides an overview of Operating Systems (OS), detailing their functions, types, and importance, along with a focus on UNIX/Linux architecture. It explains core components such as the kernel, shell, and application layers, as well as process and memory management concepts. Additionally, it discusses process scheduling, multithreading, and memory management techniques like paging and virtual memory.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

OPERATING SYSTEM

Operating System ka Overview :

1. Operating System kya hai?


Operating System (OS) ek system software hai jo computer hardware aur software ke beech ek
bridge ka kaam karta hai. Yeh ek interface provide karta hai taaki user easily computer ka use
kar sake.

2. OS ke Main Functions:
🔹 Process Management: Multiple programs ko ek saath execute karne ka management karta
hai.
🔹 Memory Management: RAM ka efficient allocation aur deallocation karta hai.
🔹 File System Management: Data ko files aur directories ke form mein store aur manage karta
hai.
🔹 Device Management: Input/Output devices jaise ki keyboard, mouse, printer ka control karta
hai.
🔹 Security & Access Control: Unauthorized access aur viruses se system ko protect karta hai.

3. Types of Operating System:


✅ Single-User OS: Ek time par ek hi user kaam kar sakta hai (e.g., Windows, macOS).
✅ Multi-User OS: Multiple users ek saath access kar sakte hain (e.g., UNIX, Linux).
✅ Real-Time OS (RTOS): Real-time processing ke liye use hota hai (e.g., Embedded Systems).
✅ Network OS: Network-based operations ke liye (e.g., Windows Server, Linux Server).
✅ Distributed OS: Multiple computers ko ek hi system ki tarah operate karta hai.

4. Popular Operating Systems:


💻 Windows, macOS, Linux, Android, iOS

5. OS ke Importance:
🔸 Without OS, computer sirf ek hardware box hoga.
🔸 Software aur applications ko efficiently run karne me madad karta hai.
🔸 User-friendly interface provide karta hai.

UNIX/Linux Architecture (Hinglish)

UNIX aur Linux ek multi-user, multi-tasking operating system hain jo stability, security, aur
flexibility ke liye jane jate hain. Inka architecture modular hota hai, jo OS ke different
components ko efficiently manage karta hai.
🔹 UNIX/Linux Architecture ke Main Layers

UNIX/Linux architecture 4 major layers me divide hota hai:

1️ Hardware Layer
2️ Kernel Layer
3️ Shell Layer
4️ Application Layer

Ab inko ek-ek karke detail me samajhte hain.

1️ Hardware Layer (Lowest Level)

✅ Is layer me CPU, Memory (RAM), Hard Disk, Input/Output Devices aate hain.
✅ Kernel isi hardware se interact karta hai aur system resources manage karta hai.

2️Kernel (Core of OS)

✅ Kernel UNIX/Linux ka sabse important part hai.


✅ Yeh hardware aur software applications ke beech mediator ka kaam karta hai.
✅ Main Functions:

 Process Management – Programs (processes) ko create, execute aur terminate karta hai.
 Memory Management – RAM ka efficient use karta hai.
 File System Management – Files aur directories ka structure manage karta hai.
 Device Management – Hardware devices ke liye drivers aur commands provide karta hai.
 Security & Access Control – User authentication aur permissions handle karta hai.

🔹 Types of Kernels:

 Monolithic Kernel – Pure UNIX/Linux kernel (faster but large size).


 Microkernel – Sirf essential functions provide karta hai (smaller, but slower).

3️Shell (User Interface to Kernel)

✅ Shell ek command-line interface (CLI) hota hai jo user aur kernel ke beech communication
establish karta hai.
✅ Yeh user ke commands ko samajh kar kernel tak pahunchata hai.
✅ Example:
 Bash (Bourne Again Shell) – Sabse common shell (Linux me default).
 Sh (Bourne Shell)
 C Shell (csh)
 Korn Shell (ksh)
 Z Shell (zsh)

💻 Example Command:

ls -l

(Yeh command directory ke files aur unke details dikhata hai.)

4️Application Layer (User Programs & Utilities)

✅ Is layer me all user-level programs aate hain jo system pe run hote hain.
✅ Example:

 Text Editors: vim, nano


 Networking Tools: ssh, ftp, ping
 System Monitoring: top, htop
 Programming Tools: gcc, python
 Package Managers: apt, yum, dnf

💻 Example Command:

sudo apt update

(Yeh system me installed software packages ko update karta hai.)

🔹 UNIX/Linux Architecture Diagram


---------------------------------
| Applications & Commands | ← (User Programs)
---------------------------------
| Shell (CLI) | ← (User Interface)
---------------------------------
| Kernel | ← (OS Core)
| - Process Management |
| - Memory Management |
| - File System Management |
| - Device Management |
| - Security Control |
---------------------------------
| Hardware (CPU, RAM, Disk) | ← (Physical System)
---------------------------------
🔹 Summary
Layer Function

Hardware Physical components (CPU, RAM, HDD)

Kernel System ka core, resource management karta hai

Shell User aur Kernel ke beech communication

Applications Software aur utilities jo users use karte hain

🔹 Why UNIX/Linux?

✅ Open-Source & Free – Linux ek free OS hai.


✅ Highly Secure – UNIX/Linux me user permissions aur encryption ka strong system hota
hai.
✅ Multi-User & Multi-Tasking – Multiple users aur processes ek saath efficiently handle kar
sakte hain.
✅ Customization – Users OS ko apni zaroorat ke mutabik modify kar sakte hain.

Kernel, Services, System Calls, and System Programs in UNIX/Linux (Hinglish)

UNIX/Linux ek powerful aur secure operating system hai jisme Kernel, Services, System Calls,
aur System Programs ka important role hota hai. Chaliye inko detail me samajhte hain!

🔹 1. Kernel (Operating System ka Core)

Kernel UNIX/Linux ka sabse important part hai jo hardware aur software applications ke
beech mediator ka kaam karta hai. Yeh system resources (CPU, Memory, I/O Devices) ko
manage karta hai.

Main Functions of Kernel:

✅ Process Management – CPU me processes ka execution control karta hai.


✅ Memory Management – RAM allocate/deallocate karta hai.
✅ File System Management – Files aur directories ko organize karta hai.
✅ Device Management – Input/Output devices (keyboard, printer, mouse) ka control karta hai.
✅ Security & Access Control – User authentication aur system security ensure karta hai.

Types of Kernel:
1️Monolithic Kernel – Pura OS ek hi kernel me hota hai (e.g., Linux).
2️Microkernel – Sirf essential features kernel me hote hain, baaki modules alag hote hain.
3️Hybrid Kernel – Monolithic + Microkernel ka mix (e.g., Windows NT, macOS).

🔹 2. Services Provided by Kernel

Kernel users aur applications ko different system services provide karta hai jo system ki smooth
working ke liye zaroori hote hain.

🔹 Process Control Services – Process creation, execution, termination, etc.


🔹 Memory Management Services – RAM allocation aur paging/swapping.
🔹 File System Services – Files create/delete, read/write operations.
🔹 Device Management Services – Devices ka access aur control.
🔹 Security Services – User authentication aur permissions.
🔹 Networking Services – Internet aur network communication support.

🔹 3. System Calls (Interface Between Kernel & User Programs)

System Calls ek interface hote hain jo user programs aur kernel ke beech communication
establish karte hain. Jab bhi koi user ya program system resources use karna chahta hai, toh woh
system calls ka use karta hai.

Types of System Calls:

✅ Process Control – fork(), exec(), exit(), wait().


✅ File Management – open(), close(), read(), write(), chmod().
✅ Device Management – ioctl(), read(), write().
✅ Information Maintenance – getpid(), alarm(), sleep().
✅ Communication – pipe(), shmget(), msgsnd(), msgrcv().

Example of System Call in C (Linux)


#include <stdio.h>
#include <unistd.h>

int main() {
printf("Process ID: %d\n", getpid()); // getpid() ek system call hai jo
process ID return karta hai
return 0;
}
🔹 4. System Programs (Utilities for Users)

System Programs wo high-level utilities hote hain jo users aur administrators system ko manage
karne ke liye use karte hain.

Types of System Programs:

✅ File Management Programs – ls, cp, mv, rm, chmod, chown.


✅ Process Management Programs – ps, kill, top, htop.
✅ Device Management Programs – df, du, mount, umount.
✅ Networking Programs – ping, netstat, ifconfig, scp, ftp.
✅ Programming Utilities – gcc, make, gdb, python.

Example Commands:

💻 File ko dekhne ke liye:

ls -l

💻 Running processes check karne ke liye:

ps aux

💻 System memory usage dekhne ke liye:

free -m

🔹 Summary Table
Concept Description

Kernel System ka core jo hardware aur software manage karta hai

Kernel dwara provide kiye gaye system features (Process, Memory, Security,
Services
Networking)

System Calls User applications aur kernel ke beech interface (e.g., fork(), read(), write())

System Programs System ko manage karne wale utilities (e.g., ls, ps, kill, gcc)

Conclusion

✅ Kernel OS ka core hota hai jo hardware aur software ko control karta hai.
✅ Services users aur programs ko system ke different functionalities use karne dete hain.
✅ System Calls user applications aur kernel ke beech communication establish karte hain.
✅ System Programs system ko manage karne ke liye utilities provide karte hain.

Agar kisi bhi topic pe aur detail chahiye toh batao!

UNIT II: Process Management & Memory Management


1. Process Management

1.1 Process Concepts

Ek process ek running program ka instance hota hai. Jab ek program execute hota hai, toh wo ek
process ban jata hai. Isme do main cheezein hoti hain:

 Program Code: Jo instructions execute ki jati hain.


 Process Control Block (PCB): Ek data structure jo process ki sari information store karta hai jaise
ki process state, program counter, CPU registers, memory limits, aur scheduling information.

1.2 Process States

Process execution ke dauraan ye states se guzarta hai:

1. New: Jab ek process create hota hai, tab wo New state me hota hai.
2. Ready: Jab process execute hone ke liye ready hota hai, par CPU assign nahi hota.
3. Running: Jab CPU kisi ek process ko execute kar raha hota hai.
4. Waiting: Jab process kisi external resource (jaise I/O device) ka wait kar raha hota hai.
5. Terminated: Jab process ka execution complete ho jata hai ya koi error aa jata hai.

1.3 Process Control Block (PCB)

PCB ek important data structure hai jo OS dwara maintain kiya jata hai. Isme ye information hoti
hai:

 Process ID (PID) – Har process ka ek unique ID hota hai.


 Process State – Process kis state me hai (New, Ready, Running, Waiting, Terminated).
 Program Counter – Jo next instruction execute hogi uska address store karta hai.
 CPU Registers – Process ke current execution ke liye required registers.
 Memory Allocation Information – Process ke memory space ki details.
 I/O Status Information – Process ke input/output devices ka status.

1.4 Operations on Processes

 Process Creation: fork() system call se ek naya process create hota hai.
 Process Termination: exit() system call ek process ko terminate karta hai.
 Process Suspension and Resumption: Kabhi-kabhi process ko temporarily suspend (pause) kiya
jata hai aur baad me resume kiya jata hai.

1.5 Inter Process Communication (IPC)

Processes ke beech communication karne ke do main tareeke hain:

1. Shared Memory – Multiple processes ek shared memory segment use karte hain jisme data
share hota hai.
2. Message Passing – Processes ek doosre ko messages bhejte hain ek IPC mechanism ka use
karke.

1.6 Process Scheduling

Process scheduling ka kaam CPU ke resources ko efficiently allocate karna hota hai.

Types of Schedulers:

 Long-Term Scheduler: Decide karta hai kaunse processes memory me load honge execution ke
liye.
 Short-Term Scheduler (CPU Scheduler): Decide karta hai kaunsa process CPU execute karega.
 Medium-Term Scheduler: Process swapping (suspend aur resume) manage karta hai.

CPU Scheduling Algorithms:

1. FCFS (First Come First Serve): Jo process pehle aata hai, wahi pehle execute hota hai.
2. SJF (Shortest Job First): Sabse chhoti execution time wale process ko select karta hai.
3. Round Robin (RR): Har process ko ek fixed time slice milta hai execution ke liye.
4. Priority Scheduling: Process execution priority ke basis par hota hai.

2. Multithreaded Programming

2.1 Threads

Thread ek lightweight process hota hai jo ek process ke andar multiple tasks parallel execute
karne ki ability deta hai.

2.2 Types of Threads

1. User-level Threads: Ye user libraries dwara manage kiye jate hain, OS inhe directly manage nahi
karta.
2. Kernel-level Threads: Ye directly OS dwara manage kiye jate hain.

2.3 Advantages of Multithreading


 Faster Execution – Multiple threads parallel execution me help karte hain.
 CPU ka Better Utilization – CPU idle nahi rehta, efficient processing hoti hai.
 System Responsiveness – Agar ek thread busy ho toh doosra task execute ho sakta hai.

3. Memory Management

3.1 Memory Allocation

Memory allocation ke do main tareeke hain:

 Static Allocation: Memory compile-time par allocate hoti hai aur execution ke dauraan change
nahi hoti.
 Dynamic Allocation: Memory runtime par allocate hoti hai aur execution ke dauraan badal sakti
hai.

3.2 Swapping

Swapping ek aisi technique hai jisme ek process ko temporarily RAM se disk me move kiya jata
hai aur wapas RAM me laaya jata hai jab execution ki zaroorat ho.

3.3 Paging

Paging ek memory management technique hai jisme memory ko fixed-size blocks me divide
kiya jata hai jinhe pages kehte hain. Page Table logical memory ko physical memory se map
karti hai.

3.4 Segmentation

Segmentation ek memory management technique hai jisme memory ko variable-size segments


me divide kiya jata hai jo logical program structures ke base par hote hain. Har segment ka ek
unique name aur size hota hai.

3.5 Virtual Memory

Virtual memory ek technique hai jo ek system ko zyada memory use karne ki suvidha deti hai jo
physically available memory se zyada ho sakti hai. Isme Demand Paging ka use hota hai jisme
sirf zaroori pages RAM me load hote hain.

3.6 Various Faults

 Page Fault: Jab ek required page memory me available nahi hota aur disk se lana padta hai.
 Segmentation Fault: Jab ek process invalid memory location access karta hai.
Conclusion

Process aur memory management ek OS ke important features hain jo system ki performance ko


direct affect karte hain. Process scheduling aur memory allocation techniques ka proper
implementation system efficiency improve karta hai. Multithreading system responsiveness aur
performance enhance karne me madad karta hai. Virtual memory aur paging jaise memory
management techniques ek system ki processing capability ko badhane me madad karte hain.

You might also like