Chapter 1: Introduction to Operating System and its Structures
1.1 What is an Operating System?
An Operating System (OS) is a program that acts as an intermediary between a user and the computer hardware. It is the first layer of software loaded into the computer's memory.
- Primary Goals: Execute user programs, make the computer system convenient to use, and utilize hardware in an efficient manner.
- Key Roles:
- Resource Allocator: Decides between conflicting requests for fair and efficient resource use.
- Control Program: Controls the execution of programs to prevent errors and improper use of the computer.
- The Kernel: The central program of the OS that is running at all times on the computer. Everything else is either a system program or an application program.
1.2 Computer System Organization & Operations
- System Components: A typical computer system consists of Users, Application Programs, the Operating System, and Computer Hardware (CPU, Memory, I/O devices).
- Computer Startup: Initiated by a bootstrap program (firmware stored in ROM or EEPROM). It initializes system aspects, loads the OS kernel, and starts execution.
- Interrupts: An interruption of the normal sequence of execution to improve processing efficiency.
- Interrupt Handler: Determines the nature of the interrupt and performs the needed actions.
- Trap: A software-generated interrupt caused by an error or user request.
- Dual-Mode Operation: Protects the OS and system components by restricting execution.
- User Mode (Mode bit = 1): Execution done on behalf of a user.
- Kernel/Monitor Mode (Mode bit = 0): Execution done on behalf of the OS. System calls change the mode from user to kernel.
- Timers: Used to prevent user programs from being stuck in infinite loops and hogging resources.
1.3 Operating System Structure Concepts
- Multiprogramming: Organizes jobs (code and data) so the CPU always has one to execute, increasing CPU utilization since a single user cannot keep the CPU and I/O devices busy at all times.
- Timesharing (Multitasking): A logical extension of multiprogramming where the CPU frequently switches between jobs, allowing multiple users to interact with the system simultaneously.
- Virtual Memory: Allows the execution of processes that do not fit entirely in the main memory.
1.4 Computing Environments & Special Purpose Systems
- Computing Environments:
- Traditional: Office (mainframe/minicomputers, networked PCs) and Home networks.
- Client-Server: Smart PCs (clients) requesting services from centralized servers (Compute-servers or File-servers).
- Peer-to-Peer (P2P): No distinct clients or servers; all nodes are peers that can act as both.
- Web-Based: Ubiquitous access with load balancers managing traffic among servers.
- Special Purpose Systems:
- Real-Time Embedded: Systems with strict, fixed time constraints (e.g., manufacturing robots, scientific experiment controls).
- Multi-media: Handled audio and video data alongside conventional text/programs.
- Hand-held: PDAs, cellular telephones using embedded OS.
1.5 The Four Views of an Operating System
An OS can be analyzed from four distinct perspectives: 1. Functional View (What it does): Handles program execution, I/O operations, file-system management, communications, exception handling, resource allocation, accounting, and protection/security.
2. Component View (Designer’s View):
- Process Management: Creating, suspending, resuming, synchronizing, and communicating between processes (active programs).
- Storage Management: Allocating/de-allocating main memory and managing secondary storage (disk scheduling).
- I/O Management: Managing device drivers, buffering, caching, and spooling.
3. Services View (User's/Programmer's View):
- System Calls: The programming interface to OS services, typically accessed via an API (Win32, POSIX, Java API) rather than direct system calls.
- Command Interpreters (Shell): Programs like bash, csh, or Korn shell that provide an interactive interface between users and the kernel.
- System Programs: Provide a convenient environment for program execution and development.
4. Structure View (How it is implemented):
- Simple Structure (MS-DOS): Not divided into modules; vulnerable to errant programs because interfaces are not well separated.
- Layered Approach (UNIX): Divided into distinct layers (Layer 0 is hardware, Layer N is the UI).
- Microkernel (Mac OS X): Moves as much as possible from the kernel into user space. Uses message passing. It is more secure and reliable but can suffer from performance overhead.
- Modules (Solaris): Uses object-oriented, loadable kernel modules. Each core component is separate but talks over known interfaces.
- Virtual Machines (VMware, JVM): Treats the OS kernel and hardware as one underlying layer, creating the illusion of multiple isolated physical machines, each with its own CPU and memory. Excellent for OS research and development.