Operating System
OS Part-1
OS Part-2
- File Concepts and Access methods
- Free Space Management and Allocation methods
- Directory Systems and Protection
- File Organization, Sharing and Implementation issues
- Disk and Drum Scheduling
- I/O Devices Organisation & I/O Buffering
- I/O Hardware, Kernel I/O subsystem and Transforming I/O Requests to Hardware Operations
- Device Drivers and Path Management
- Device Driver Sub Modules and Procedure
- Device Scheduler and Handler
- Interrupt Service Routine (ISR)
- File System in Linux and Windows
OS Part-3
- Process and Process Control Block(PCB)
- Process Scheduling( Preemptive and Non Preemptive)
- Scheduling Algorithms
- Algorithm Evaluation
- Multiple Processor Scheduling
- Real Time Scheduling
- Operations on Processes
- Threads
- Inter-Process Communication
- Precedence Graphs
- Critical Section Problem
- Semaphores
- Classical Problems of Synchronization
- DeadLock
- Deadlock Prevention and Avoidance
- Deadlock Detection and Recovery
- Process Management in Linux
OS Part-4
- Memory Hierarchy in OS
- Concepts of Memory Management
- MFT and MVT
- Logical and Physical Address Space
- Swapping
- Contiguous and Non Contiguous Memory Allocation
- Paging
- Segmentation
- Paging Combined with Segmentation
- Structure and Implementation of Page Table
- Virtual Memory in OS
- Cache Memory Organization
- Demand Paging
- Page Replacement Algorithms
- Allocation of Frames and Thrashing
- Demand Segmentation
OS Part-5
- Distributed Operating System: Introduction and Types
- Distributed OS: Design Issues
- Distributed OS: File System
- Distributed OS: Remote File Access
- Remote Procedure Call(RPC)
- Remote Method Invocation(RMI)
- Distributed Shared Memory
- Parallel Processing and Concurrent Programming
- Security and Threats Protection in Distributed OS
- Security Design Principles and Authentication in Distributed OS
- Sensor Network and Parallel OS
File Concepts aur Access Methods in Operating System
1. File Concepts
File Kya Hota Hai?
Ek file data ka collection hota hai jo kisi storage device (HDD, SSD, USB, etc.) par store kiya jata hai. Yeh data ko store karne aur retrieve karne ka basic unit hai jo Operating System ke dwara manage hota hai.
Types of Files
1. Text Files – Jo human-readable text contain karti hain (e.g.,
.txt
,.html
).2. Binary Files – Jo machine-readable binary format me store hoti hain (e.g.,
.exe
,.jpg
,.mp3
).3. System Files – OS ke boot aur operations ke liye zaroori (e.g.,
.dll
,.sys
).4. Database Files – Structured data store karti hain (e.g.,
.db
,.mdb
).
File Attributes
Har file ke kuch properties (metadata) hoti hain:
Name – Unique name jo file identify karta hai.
Type – File ka format (
.txt
,.png
,.pdf
).Size – File kitni space occupy karti hai.
Location – File system me kaha stored hai.
Protection – Read, write, execute permissions.
Creation Time – Kab file create hui thi.
Last Access Time – Last kab file open ya modify hui thi.
File Structure
Files ke andar ka data structure alag-alag ho sakta hai:
Byte Sequence – Simple byte storage, jaise Unix systems me hota hai.
Record Sequence – Fixed-size records hote hain, jaise databases me.
Tree Structure – Hierarchical file system jisme folders aur subfolders hote hain.
2. File Access Methods
File access methods define karte hain ki data file se kaise read/write hoga.
1. Sequential Access
Sabse common method hai.
File ke records ek sequence me read hote hain, backward movement mushkil hota hai.
Agar modification karna ho toh poori file dobara likhni pad sakti hai.
Example:
Text file line by line read karna.
Video ya audio file sequentially play karna.
Diagram:
| Record 1 | → | Record 2 | → | Record 3 | → | Record 4 |
Data sequence me access hota hai, Record 1 ke baad Record 2 read hoga.
Advantages:
Simple aur easy to implement.
Large data read karne ke liye best hai (e.g., logs).
Disadvantages:
Direct access possible nahi hota.
Agar ek specific record chahiye toh pura file scan karna padega.
2. Direct (Random) Access
File records me divided hoti hai, aur koi bhi record directly access kiya ja sakta hai.
Best for databases jisme specific record jaldi retrieve karna hota hai.
Example:
Student ki record database me search karna.
PDF ya eBook me kisi bhi page par directly jump karna.
Diagram:
|Record 1| |Record 2| |Record 3| |Record 4|
↑ ↑ ↑
Kisi bhi position se direct access
Advantages:
Fast access, kisi bhi record ko directly fetch kar sakte hain.
Unnecessary data process nahi hota.
Disadvantages:
Complex implementation hoti hai.
Indexing ke liye extra memory chahiye hoti hai.
3. Indexed Sequential Access
Sequential aur Direct Access ka combination hai.
Index Table maintain ki jati hai jo file ke specific blocks ko point karti hai.
Jab large files hoti hain aur fast searching chahiye tab yeh best hota hai.
Example:
Phonebook search – Pehle index ke through page find karo, phir sequentially names check karo.
Database search with indexed fields – Jaldi data retrieve karna.
Diagram:
Index Table → Points to → File Blocks
-------------------------------------
| Index 1 | → | Block A |
| Index 2 | → | Block B |
| Index 3 | → | Block C |
-------------------------------------
Advantages:
Pure sequential access se fast searching hoti hai.
Direct access jitni memory use nahi hoti.
Disadvantages:
Index table maintain karna mushkil hota hai.
Direct access jitna fast nahi hota.
Comparison Table
Access Method | Kaise Kaam Karta Hai | Example Use Case | Speed | Best For |
---|---|---|---|---|
Sequential Access | Data order me read hota hai | Audio/Video Streaming | Slow | Large Continuous Files |
Direct Access | Kisi bhi part me jump kar sakte hain | Databases | Fast | Random File Searching |
Indexed Sequential Access | Index ke through fast lookup hota hai | Phonebook search | Medium | Large structured data |
Conclusion
File concepts aur access methods ko samajhna important hai kyunki ye efficient data storage aur retrieval ke liye zaroori hote hain. Har access method ki apni advantages aur disadvantages hoti hain, aur use case ke hisaab se best method select kiya jata hai.