.. include:: global.rst ************************************************ Chapter 1: Introduction to Operating Systems ************************************************ What is an OS? =================== * An operating system (OS) is the core software that manages a computer’s hardware and provides services for other software (applications) to run. Think of it as the middleman between you (the user), your programs, and the physical machine. * Key roles of an OS: * Resource Management * Controls hardware resources: CPU, memory (RAM), storage, and input/output devices (keyboard, mouse, printer, etc.). * Makes sure different programs can share these resources without interfering with each other. * Process Management * Starts, schedules, and stops programs (processes). * Ensures each program gets fair use of CPU time. * Memory Managemen * Allocates memory to programs when they need it. * Keeps programs from overwriting each other’s data. * File System Management * Organizes data into files and folders on storage devices. * Handles permissions (who can read, write, or execute a file). * User Interface * Provides a way to interact with the computer (command-line or graphical desktop). * Examples: Windows desktop, macOS Finder, Linux terminal. * Device Management * Uses drivers to let the OS and applications communicate with hardware like printers, graphics cards, and USB devices. History of Operating Systems ================================ * 1950s: No OS → Batch processing * 1960s: Time-sharing & UNIX * 1980s: PCs → MS-DOS, Mac OS * 1990s: GUI, Networking, Windows dominance * 2000s–Now: Linux, macOS, Windows, Android, iOS, and cloud systems Types of Operating Systems ============================== 1. Batch Operating System -------------------------- - **How it works:** Jobs are collected in batches and executed one after another without user interaction. - **Use case:** Early mainframes (1950s–60s). - **Pros:** Efficient for large jobs, no idle time. - **Cons:** No real-time user interaction, debugging is slow. - **Example:** IBM OS/360. 2. Time-Sharing (or Multi-User) Operating System ------------------------------------------------ - **How it works:** Many users share the CPU at the same time. The CPU switches rapidly between tasks, giving the illusion that everyone has their own computer. - **Use case:** Multi-user systems, research labs. - **Pros:** Interactive, better resource sharing. - **Cons:** Security issues, slower if too many users. - **Example:** UNIX, Multics. 3. Real-Time Operating System (RTOS) ------------------------------------ - **How it works:** Designed to process data immediately, with strict timing constraints. - **Types:** - **Hard RTOS** – Deadlines must be met (e.g., flight control). - **Soft RTOS** – Occasional delays acceptable (e.g., video streaming). - **Use case:** Embedded systems, robotics, medical devices. - **Pros:** Predictable, reliable. - **Cons:** Expensive to design, limited multitasking. - **Examples:** VxWorks, QNX, RTLinux. 4. Multiprogramming Operating System ------------------------------------ - **How it works:** Multiple programs are kept in memory, and the CPU switches between them when one waits for I/O. - **Use case:** General-purpose computers. - **Pros:** Better CPU utilization. - **Cons:** Complex to manage memory & processes. - **Example:** Early UNIX, OS/2. 5. Distributed Operating System ------------------------------- - **How it works:** Manages a group of independent computers and makes them appear as a single system to the user. - **Use case:** Clusters, cloud systems. - **Pros:** Resource sharing, fault tolerance. - **Cons:** Security and coordination are difficult. - **Examples:** Amoeba, Google’s Borg (inspired Kubernetes). 6. Network Operating System (NOS) --------------------------------- - **How it works:** Runs on a server to provide services like file sharing, printer access, user management, and networking. - **Use case:** Client-server environments. - **Pros:** Centralized management. - **Cons:** Server dependency. - **Examples:** Novell NetWare, Windows Server. 7. Mobile Operating System -------------------------- - **How it works:** Designed for smartphones and tablets with touch interfaces, mobile apps, and wireless connectivity. - **Pros:** Portable, energy-efficient. - **Cons:** Limited compared to desktop OS. - **Examples:** Android, iOS. Summary Table ============= .. list-table:: :header-rows: 1 :widths: 20 20 40 * - Type - Example - Key Use Case * - Batch OS - IBM OS/360 - Job scheduling on mainframes * - Time-Sharing OS - UNIX - Multi-user systems * - Real-Time OS - VxWorks, QNX - Embedded, robotics, avionics * - Multiprogramming OS - OS/2, UNIX - General-purpose computers * - Distributed OS - Amoeba, Google - Cluster & cloud computing * - Network OS - Windows Server - Client-server networks * - Mobile OS - Android, iOS - Smartphones & tablets Operating System Services and User Interface ============================================ Operating System Services ------------------------- The operating system provides a set of essential **services** to make the computer usable and efficient: 1. **Program Execution** - Load programs into memory and run them. - Handle normal termination or errors. 2. **I/O Operations** - Manage input/output devices (keyboard, mouse, disk, printer, etc.). - Provide uniform interfaces through device drivers. 3. **File System Management** - Create, read, write, and delete files. - Organize data into directories and manage permissions. 4. **Communication** - Enable processes to communicate via **inter-process communication (IPC)** such as pipes, message queues, and shared memory. - Support networking for distributed systems. 5. **Error Detection & Handling** - Detect errors in hardware or software. - Provide debugging aids and prevent crashes. 6. **Resource Allocation** - Manage CPU scheduling, memory, and device assignment. - Allocate fairly when multiple users or processes compete. 7. **Protection & Security** - Control access to resources. - Ensure authentication, authorization, and safe execution of programs. Operating System User Interfaces -------------------------------- The **User Interface (UI)** is how users interact with the operating system. Types of Interfaces ^^^^^^^^^^^^^^^^^^^ 1. **Command-Line Interface (CLI)** - Text-based, requires typing commands. - Examples: UNIX shell, Windows Command Prompt, PowerShell. 2. **Graphical User Interface (GUI)** - Windows, icons, menus, and pointers (WIMP model). - Examples: Microsoft Windows, macOS, GNOME (Linux). 3. **Menu-Driven Interface** - Users select options from menus. - Examples: ATMs, older feature phones. 4. **Touch-Based / Mobile Interface** - Uses gestures, swipes, and taps. - Examples: Android, iOS. 5. **Voice-Based & Natural Interfaces (Modern)** - Voice commands and AI assistants (Siri, Alexa). - Used in IoT and smart devices.