TheHingineer

  • Operating System


  • OS Part-1

  • OS Part-2

  • OS Part-3

  • OS Part-4

  • OS Part-5

  • 1. System Calls (OS ke System Calls)

    System Calls Kya Hote Hain?

    System Calls user programs aur operating system ke beech ka interface hote hain. Jab koi program hardware ya OS services ka use karna chahta hai, toh woh system call ke through request bhejta hai.

    Example Situation

    Agar tum Notepad me ek file save karna chahte ho, toh program directly hard disk access nahi kar sakta. Yeh kaam OS ke system calls karte hain.

    System Calls Kaise Kaam Karte Hain?

    1. User program request bhejta hai (jaise file open karni hai).

    2. System Call activate hota hai (OS ka function call hota hai).

    3. OS operation perform karta hai (hard disk access karta hai).

    4. OS result wapas bhejta hai (file successfully open ho gayi).

    Diagram: System Call Execution

    [ User Program ]
         |
         | Request: File Open
         v
    [ System Call (OS)]
         |
         | OS accesses Hard Disk
         v
    [ Hardware (Disk)]
     

    Types of System Calls 

    1. Process Control 

    • Purpose: Naye process create, execute aur terminate karne ke liye.

    • Example System Calls:

      • fork() → Naya process banata hai.

      • exit() → Process ko terminate karta hai.

    • Example Use: Jab tum Google Chrome open karte ho.


    2. File Management 

    • Purpose: File ko open, read, write aur delete karna.

    • Example System Calls:

      • open() → File ko open karega.

      • read() → File se data read karega.

      • write() → File me data likhega.

      • close() → File ko band karega.

    • Example Use: Jab tum MS Word me document save karte ho.


    3. Device Management 

    • Purpose: Keyboard, Mouse, Printer jaise devices ka control lena.

    • Example System Calls:

      • ioctl() → Device ki settings change karta hai.

      • read() → Device se input leta hai.

    • Example Use: Jab tum printer se PDF file print karte ho.


    4. Information Maintenance 

    • Purpose: OS ya process ki information retrieve karna.

    • Example System Calls:

      • getpid() → Process ID dega.

      • gettime() → System ka current time batayega.

    • Example Use: Jab tum Windows ka system time check karte ho.


    5. Communication (Inter-Process Communication – IPC)

    • Purpose: Ek process ko doosre process se baat karne dena.

    • Example System Calls:

      • pipe() → Dono processes ke beech ek communication pipe banata hai.

      • send() → Data doosre process ko bhejta hai.

    • Example Use: Jab tum WhatsApp message bhejte ho.


    System Calls ka Example (C Language me)

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

    int main() {
    int file = open("example.txt", O_WRONLY | O_CREAT, 0644);
    write(file, "Hello, System Calls!", 20);
    close(file);
    return 0;
    }

    🔹 Yeh program ek file banata hai, usme text likhta hai, aur phir file ko close kar deta hai.


    2. System Boot (OS Booting Process)

    System Boot Kya Hota Hai?

    Jab tum computer ka power button press karte ho, toh System Boot process start hoti hai. Yeh process OS ko memory me load karne aur system ko ready karne ka kaam karti hai.


    System Boot ke Steps

    1. Power On & BIOS Execution

    • Jab tum power button dabate ho, toh sabse pehle BIOS (Basic Input/Output System) activate hota hai.

    • BIOS system hardware check karta hai (RAM, Hard Disk, Keyboard, etc.).

    • Is process ko Power-On Self-Test (POST) kaha jata hai.


    2. Bootloader Execution

    • BIOS ke baad Bootloader activate hota hai.

    • Bootloader ka kaam Operating System ko locate aur load karna hota hai.

    • Examples:

      • Windows Boot Manager (Windows ke liye)

      • GRUB Bootloader (Linux ke liye)


    3. Kernel Loading

    • Bootloader OS kernel ko RAM me load karta hai.

    • Kernel process, memory aur devices ko initialize karta hai.


    4. System Initialization

    • OS system services aur background processes start karta hai.

    • Login screen dikhai deti hai, aur system ready ho jata hai.


    Diagram: System Boot Process

    [ Power ON ]
        ↓
    [ BIOS Execution & POST ]
        ↓
    [ Bootloader Loads OS ]
        ↓
    [ OS Kernel Loads ]
        ↓
    [ System Ready for Use ]
     

    Types of Booting 

    1. Cold Boot

    • Jab system completely off ho aur fir start kiya jaye.

    • Example: Tumne laptop band kiya tha aur dobara ON kiya.

    2. Warm Boot

    • Jab system restart hota hai bina power off kiye.

    • Example: Tumne Ctrl + Alt + Del press karke Windows restart kiya.


    Bootloader ka Example (Linux me GRUB Bootloader)

    Linux ka GRUB Bootloader system boot process ko manage karta hai.

    Example: GRUB Configuration File

    GRUB_DEFAULT=0
    GRUB_TIMEOUT=5
    GRUB_CMDLINE_LINUX="quiet splash"
     

    🔹 Isme default OS set hota hai aur boot wait time define hota hai.


    Conclusion (Summary)

    ✅ System Calls programs aur OS ke beech bridge ka kaam karte hain.
    ✅ System Boot process me BIOS se lekar OS startup tak ka process hota hai.
    ✅ Booting Steps: BIOS → Bootloader → Kernel → System Ready.

    Scroll to Top