TheHingineer

  • Operating System


  • OS Part-1

  • OS Part-2

  • OS Part-3

  • OS Part-4

  • OS Part-5

  • System Protection in Operating System

    1. System Protection Kya Hota Hai?

    System Protection ka matlab hai OS ka users, processes aur system resources ko unauthorized access aur malicious activities se bachana.

    🔹 Example: Ek computer me agar ek user apne personal files protect karna chahta hai taaki doosra user bina permission ke unhe delete na kare, toh OS ki protection mechanisms ka use kiya jata hai.


    2. System Protection Kyun Zaroori Hai?

    1. Unauthorized Access Rokna – Users sirf apne files aur resources ko access kar sakein.

    2. Process Isolation – Ek program doosre program ke kaam me interfere na kare.

    3. Data Integrity Maintain Karna – Data safe aur unchanged rahe.

    4. Resource Allocation Control – Har user ko fairly CPU, memory aur storage mile.

    5. Security Badana – OS viruses, malware aur hackers se system ko safe rakhe.


    3. System Protection Ke Important Mechanisms

    1. Access Control Mechanisms

    OS files aur system resources ko access karne ke rules define karta hai.

    🔹 Example: Linux me file permissions ka use hota hai taaki sirf authorized users hi read, write ya execute kar sakein.

    Linux File Permission Example:

    ls -l myfile.txt
    -rw-r–r– 1 user user 1024 Mar 20 12:00 myfile.txt
    • rw- → Owner ke paas read aur write ka access hai.

    • r-- → Group sirf read kar sakta hai.

    • r-- → Baaki sab sirf read kar sakte hain.


    2. User Authentication

    • OS users ko verify karta hai taaki sirf valid users hi system use kar sakein.

    • Authentication methods:

      • Password Authentication

      • Biometric Authentication (fingerprint, face unlock)

      • Two-Factor Authentication (2FA)

    🔹 Example: Windows ya macOS me login karne ke liye password ya fingerprint ka use hota hai.


    3. Process Isolation

    • Ek process doosre process ke memory aur resources ko access na kare.

    • OS virtual memory aur paging techniques ka use karta hai.

    🔹 Example: Agar Google Chrome ka ek tab crash ho jaye, toh baaki tabs aur system par asar nahi padta.


    4. Hardware-Based Protection

    • Modern CPUs protection rings ka use karte hain taaki security ensure ki ja sake.

    CPU Protection Rings Diagram:

    +------------+
    | Ring 3     | User Applications (Least Privilege)
    +------------+
    | Ring 2     | System Services & Drivers
    +------------+
    | Ring 1     | More Privileged Drivers
    +------------+
    | Ring 0     | Kernel Mode (Highest Privilege)
    +------------+

    🔹 Ring 0 (Kernel Mode) – Full control hota hai.
    🔹 Ring 3 (User Mode) – Restricted mode jisme normal programs run karte hain.

    ✅ Benefit: Agar ek user program crash hota hai, toh pura OS affect nahi hota.


    5. File aur Data Protection

    • OS files aur data ko encryption aur access control se protect karta hai.

    • Backup rakha jata hai taaki data loss avoid ho sake.

    🔹 Example: Windows BitLocker ka use karke hard disk ka encryption kiya jata hai.


    6. Network Protection

    • OS ko network se aane wale malware aur hacking attacks se bachana zaroori hota hai.

    • Firewalls aur antivirus software system ki security badhate hain.

    🔹 Example: Windows Defender Firewall suspicious internet connections block karta hai.


    4. Example: File Protection Program in C

    Niche ek simple C program diya gaya hai jo file permissions set karta hai taaki unauthorized users file modify na kar sakein:

    #include <stdio.h>
    #include <sys/stat.h>

    int main() {
    char filename[] = “protected_file.txt”;

    // File permissions set karna: Owner read/write kare, others sirf read karein
    chmod(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);


    printf("File permissions updated for %s\n", filename);
    return 0;
    }

    🔹 Yeh program ensure karega ki file ko sirf owner modify kar sake, doosre log sirf read kar sakein.


    5. Conclusion (Summary)

    ✅ System Protection system aur users ke data ko secure banata hai.
    ✅ OS multiple security techniques use karta hai jaise authentication, process isolation aur access control.
    ✅ Hardware-based protection jaise CPU rings OS security badhate hain.
    ✅ Firewalls aur encryption ka use unauthorized access aur hacking se bachne ke liye hota hai.

    Scroll to Top