M

Operating System Structures

Chapter 2: Operating-System Structures

Overview
  • Operating System Services: Essential functions provided to users and applications.

  • User Operating System Interface: Interaction methods between the user and the OS, including Command-Line Interfaces (CLI) and Graphical User Interfaces (GUI).

  • System Calls: Interface for programs to access OS services.

  • Types of System Calls: Various system functionalities categorized into types.

  • System Programs: User-facing programs that interact with the OS.

  • Operating System Design and Implementation: Frameworks and principles governing OS architecture.

  • Operating System Structure: Exploration of the inner workings and components of an OS.

  • Operating System Debugging: Techniques for identifying and fixing bugs in the OS.

  • Operating System Generation: Configuring the OS for specific hardware.

  • System Boot: The process of starting the operating system upon powering on the system.

Objectives
  • Services Description: To detail services provided to users, processes, and systems by the OS.

  • Structuring Discussion: To explore various structuring methods of operating systems.

  • Installation and Customization: To explain installation, customization, and boot procedures for operating systems.

Operating System Services
  • Execution Environment: OS provides an environment for program execution and services to users.

  • User-Friendly Services:

    • User Interface: Interacts via CLI, GUI, or Batch processing.

    • CLI (Command-Line Interface): Enables direct user command input, can fetch and execute commands.

    • GUI (Graphical User Interface): Utilizes icons and visual metaphors, enhances user interaction.

    • Program Execution: Load and run programs, handle normal and error termination.

    • I/O Operations: Manage input/output operations for files and I/O devices.

    • File-System Manipulation: Read, write, create, delete, and manage files and directories.

    • Communications: Enable information exchange using shared memory or message passing.

    • Error Detection: Monitor errors in CPU, memory, I/O; implement error-handling actions.

Functions for System Efficiency
  • Resource Allocation: Distribute CPU cycles, memory, file storage, and I/O devices among multiple users or jobs.

  • Accounting: Track resource usage by users.

  • Protection and Security: Control access to resources; ensure security against unauthorized access and maintain data integrity.

User Operating System Interface
  • CLI Characteristics:

    • Allows command entry directly through keyboard input.

    • Commands can be built-in or designated programs, requiring different shells.

  • GUI Characteristics:

    • Integrates user-friendly elements: icons, gestures, and mouse actions to facilitate user interactions.

    • Examples include Microsoft Windows (GUI with CLI support) and Mac OS X (Aqua interface).

  • Touchscreen Interfaces: Designed specifically for touch-input, using gestures and voice commands for interface navigation.

System Calls
  • Definition: A programming interface to access the OS services, typically written in high-level languages (C/C++).

  • Accessing System Calls: Primarily through high-level Application Programming Interfaces (APIs) rather than calling system calls directly.

  • Common APIs:

    • Win32 API for Windows.

    • POSIX API for UNIX, Linux, and macOS.

    • Java API for Java applications.

Example of a System Call
  • File Copy Operation: System call sequence to copy contents from one file to another.

  • API Example of read() function:

    • Signature: ssize_t read(int fd, void *buf, size_t count);

    • Parameters:

    • int fd: File descriptor to read data from.

    • void *buf: Buffer to store read data.

    • size_t count: Maximum number of bytes to read.

    • Returns number of bytes read on success; returns -1 on error and signals end of file with 0.

System Call Implementation
  • Interface and Management: Each system call is linked by unique numbers, passed through a table indexed for invocation.

  • ABIs and APIs: The operating system hides implementation details from the programmer, who needs only to understand the API.

Parameter Passing Methods
  1. Registers: Pass parameters through processor registers (limited number).

  2. Memory Block: Store parameters in a block and pass its address.

  3. Stack Method: Push parameters onto the stack for the OS to pop.

Types of System Calls
  • Process Control:

    • Create and terminate processes, allocate/release memory, manage process events, etc.

  • File Management:

    • Operations include creating, deleting, opening, and reading files.

  • Device Management:

    • Managing I/O devices and their associated operations.

  • Information Maintenance:

    • Retrieve and set time, date, and system attributes.

  • Communications:

    • Facilitate inter-process communication through message passing or shared memory.

  • Protection:

    • Manage resource access and permission settings.

System Programs
  • Definition: Programs that provide a development and execution environment, categorized into:

    • File manipulation services.

    • Status information retrieval and display.

    • Programming language support (software development tools).