TheHingineer

  • Operating System


  • OS Part-1

  • OS Part-2

  • OS Part-3

  • OS Part-4

  • OS Part-5

  • Directory Systems & File Protection in Operating System

    1. Directory Systems in OS

    Ek directory ek structure hota hai jo files ko organize aur manage karta hai taaki unko easily access kiya ja sake. Ye file system ka important part hota hai jo storage me files ko systematically arrange karta hai.

    Directory Structures ke Types

    1. Single-Level Directory

    • Saari files ek hi directory me hoti hain.

    • Simple systems (MS-DOS, early computers) me use hota tha.

    Example:

    Root Directory
    │── File1.txt
    │── File2.doc
    │── File3.pdf
     

    ✅ Advantages:

    ✔ Implementation simple hai.
    ✔ Searching fast hoti hai.

    ❌ Disadvantages:

    ✖ Agar do files ka same naam ho, toh conflict ho sakta hai.
    ✖ File organization mushkil hoti hai.


    2. Two-Level Directory

    • Har user ke liye ek alag directory hoti hai.

    Example:

    Root Directory
    │── User1
    │ ├── FileA.txt
    │ ├── FileB.doc
    │── User2
    │ ├── FileX.pdf
    │ ├── FileY.mp3
     

    ✅ Advantages:

    ✔ Users ke beech name conflicts nahi hote.
    ✔ Better organization hoti hai.

    ❌ Disadvantages:

    ✖ Users ek doosre ki files easily access nahi kar sakte.


    3. Hierarchical Directory (Tree Structure)

    • Directories ke andar subdirectories hoti hain.

    • Modern OS (Windows, Linux, macOS) me use hota hai.

    Example:

    Root Directory
    │── Documents
    │ ├── College
    │ │ ├── Notes.docx
    │── Music
    │ ├── Rock
    │ │ ├── Song.mp3
     

    ✅ Advantages:

    ✔ Better organization aur file sharing possible hai.

    ❌ Disadvantages:

    ✖ Structure thoda complex ho jata hai.


    4. Acyclic Graph Directory

    • Files ko multiple directories me share kiya ja sakta hai.

    Example:

    Root Directory
    │── User1
    │ ├── Project.doc
    │── User2
    │ ├── ShortcutProject.doc
     

    (User2 Project.doc ka shortcut use karke access kar sakta hai.)

    ✅ Advantages:

    ✔ File sharing easy ho jata hai.
    ✔ Duplicate files ki zaroorat nahi hoti.

    ❌ Disadvantages:

    ✖ Agar original file delete ho jaye, toh link break ho sakta hai.


    5. General Graph Directory

    • Acyclic Graph ki tarah hota hai, but cycles allow hoti hain.

    Example:

    User1 → User2 → User3 → User1 (Cycle)

    ✅ Advantages:

    ✔ Maximum flexibility hoti hai.

    ❌ Disadvantages:

    ✖ File tracking complicated ho jati hai.


    2. File Protection in OS

    File protection ka matlab hai unauthorized users ko files modify ya access karne se rokna.

    Common Threats to File Security

    🔴 Unauthorized Access – Bina permission kisi aur ki files dekhna.
    🔴 Data Corruption – Virus ya accidental deletion ki wajah se files kharab ho sakti hain.
    🔴 Data Theft – Sensitive files ka chori hona.

    File Protection Techniques

    1. Access Control (Permissions)

    • Users ke liye different access rights set kiye jate hain.

    • Access Control List (ACL) define karti hai ki kaun read, write ya execute kar sakta hai.

    Example:

    User Read Write Execute
    Admin ✅ ✅ ✅
    User1 ✅ ❌ ❌
    Guest ❌ ❌ ❌

    2. Password Protection

    • File ko access karne ke liye password set kiya jata hai.

    Example:

    File: FinanceReport.pdf
    Password: ********
     

    ✅ Simple aur effective security method hai.


    3. Encryption

    • File ka data encode kiya jata hai, taaki bina correct key ke koi read na kar sake.

    Example:

    Original File: Hello World
    Encrypted File: x1#A9kL2@
     

    ✅ Highly secure method hai jo banking, government, aur personal data protection ke liye use hota hai.


    4. File Permissions (Read, Write, Execute)

    • Har file ke liye OS permissions assign karta hai:

      1. Read (r) – File ko sirf dekh sakte hain.

      2. Write (w) – File me changes kar sakte hain.

      3. Execute (x) – Agar file executable hai toh usko run kar sakte hain.

    Example (Linux File Permissions):

    -rwxr--r-- Owner Group Others
     

    Explanation:

    • rwxOwner (Read, Write, Execute kar sakta hai)

    • r--Group (Sirf Read kar sakta hai)

    • r--Others (Sirf Read kar sakta hai)

    ✅ Ye Linux/Unix systems me use hota hai security ke liye.


    5. Backup & Recovery

    • Files ka backup regularly maintain kiya jata hai taaki data loss na ho.

    Example:

    Backup Frequency: Har 24 hours
    Backup Location: Cloud Storage
     

    ✅ Agar system crash ho jaye ya koi file delete ho jaye, toh usko wapas restore kiya ja sakta hai.


    Conclusion

    🔹 Directory systems files ko systematically organize karne ka important tool hai.
    🔹 File protection mechanisms unauthorized access ko prevent karne ke liye zaroori hain.
    🔹 Encryption, passwords, ACLs, aur backups file security ke best techniques hain.

    Scroll to Top