Chapter 2 Operating System Structure

Operating System Structure

Chapter Overview

  • Understanding the fundamentals of operating system structures is crucial for efficient program execution and resource management.


Outline

  • Operating System Services

  • User and Operating System Interface

  • System Calls

  • System Programs

  • Operating System Structures


Operating System Services

  • Provides execution environment for programs and services needed by users and other system programs.

  • Types of Services:

    • User Interface:

      • Command-Line Interface (CLI)

      • Batch processing

      • Graphical User Interface (GUI)

    • Program Execution: Load and run programs.

    • I/O Operations: Facilitate interaction with I/O devices.

    • File-System Manipulation: Aid in reading/writing files.

    • Communications: Enable exchange of information between processes.

    • Error Detection: Detect and correct errors for reliability.

    • Resource Allocation: Distribute resources like CPU cycles to multiple jobs.

    • Accounting: Track resource usage for billing.

    • Protection and Security: Control access to system resources and protect from unauthorized access.


User and Operating System Interface

Command Line Interface (CLI)

  • Allows direct command entry.

  • Implemented in the kernel or via system programs.

  • Examples include shells like:

    • C Shell

    • Bourne Shell

  • Functions as follows:

    • Fetches user command and executes it.

    • Loads programs into memory for execution.

Batch Processing

  • Manages multiple user jobs in sequence.

  • Executes jobs and provides output after processing.

Graphical User Interface (GUI)

  • Offers a user-friendly interface with a desktop layout.

  • Uses icons to represent files and programs.

  • Developed at Xerox PARC and now includes:

    • Microsoft Windows (with CLI)

    • Apple Mac OS X (Aqua interface with UNIX kernel)

    • Various UNIX/Linux distributions (CDE, KDE, GNOME).


System Calls

  • Programmatic interface to OS services, often using C or C++.

  • Accessed via higher-level APIs rather than direct calls.

  • Common APIs include:

    • Win32 API: For Windows systems

    • POSIX API: For POSIX-compliant systems

    • Java API: For the Java Virtual Machine (JVM).

Example System Call for Copying a File

  • Sequence includes:

    • Acquire input/output file names.

    • Open input file and check existence.

    • Create output file while checking for pre-existence.

    • Read from input and write to output until completion.


Types of System Calls

  1. Process Control:

    • Create/terminate processes, manage memory, signal events.

  2. File Manipulation:

    • Create, read, write, delete files/directories;

    • Move and copy operations.

  3. Device Management:

    • Request and release device resources, perform read/write operations.

  4. Information Maintenance:

    • Acquire system-related info like user number, memory status, etc.

  5. Communications:

    • Manage connections, send/read messages.

  6. Protection:

    • Manage user access permissions.


System Programs

  • Provide an environment for program execution and development.

  • Include:

    • File Manipulation Tools: For creating, renaming, listing files.

    • Status Information Tools: Retrieve system information.

    • File Modification Tools: Text editors and file search commands.

    • Programming Language Support: Compilers, assemblers, debuggers.

    • Background Services: Perform system maintenance tasks like disk checking.

    • Application Programs: Run user applications, not part of OS but interact with it.


Operating System Structures

Overview

  • General-purpose OS structures vary from simple to complex designs:

    • Simple Structure: Non-modular, as seen in MS-DOS.

    • Layered Structure: Layers built on lower layers; e.g., Windows NT.

    • Microkernel Structure: Minimally sized kernel with user space for services; e.g., Minix 3.

    • Modular Structure: Loadable kernel modules, e.g., in Linux.

    • Hybrid Structure: Combines multiple models; e.g., Mac OS X, Linux.

Simple Structure

  • Example: MS-DOS is a compact, non-modular system with functionality tightly integrated.

Layered Structure

  • Example: Windows NT organizes the OS into layered components for modular design.

Microkernel Structure

  • Example: Minix 3 emphasizes smaller kernels and message passing between components.

Modular Structure

  • Adopts object-oriented principles, allowing core components to be separate and loadable as needed.

Hybrid Structure

  • Combines features from various modalities for performance and security optimizations across different platforms like Linux and Mac OS X, enhancing usability.


Operating System Structures for Mobile

  • iOS: Based on Mac OS X; functional adaptations for mobile hardware.

  • Android: Open-source; Linux kernel foundation with its unique features, runtime environment, and application frameworks.

robot