Operating System Concepts - Chapter 2: Operating-System Structures
Operating System Concepts - Chapter 2: Operating-System Structures
Objectives
- Describe the services provided by an operating system to users, processes, and other systems.
- Discuss various ways of structuring an operating system.
- Explain installation, customization, and booting of operating systems.
Operating System Services
- Execution of Programs: The OS provides an environment for executing programs through services.
- User Interface: Varies between Command-Line Interface (CLI) and Graphical User Interface (GUI).
- Batch Program Execution: Load and run programs, manage normal or abnormal exits.
- I/O Operations: Handles input/output actions for running programs, managing files and devices.
- File-System Manipulation: Programs need to manage files and directories through operations like reading, writing, creating, and deleting files.
- Communication: Supports processes exchanging data, either on the same machine or over a network, often via shared memory or message passing.
- Error Detection: The OS monitors errors in hardware, software, and I/O operations, taking corrective actions as necessary.
- Resource Allocation: In a multitasking environment, the OS allocates resources (CPU, memory, storage) to competing processes.
- Accounting: Keeps track of resource usage for auditing and billing.
- Protection and Security: Ensures that resources are accessed only by authorized users, providing mechanisms for user authentication and access control.
User Operating System Interface
- Command-Line Interface (CLI): Allows users to type commands directly. Implemented in the kernel or as a separate program, different shells may be involved.
- Graphical User Interface (GUI): A user-friendly interface that uses windows, icons, and menus, facilitating interactions via mouse and keyboard.
- Touchscreen Interfaces: Adaptations for user interactions with gestures and virtual keyboards.
System Calls
- Purpose: Provide a programming interface to OS services, accessed generally via high-level APIs (e.g., Win32 for Windows, POSIX for UNIX-based systems).
- Examples: System call to copy a file represented as
cp afile anewcopy in UNIX systems. - Implementation: Each system call has an associated number, and a system call interface invokes the required function in the kernel.
- Parameter Passing: Parameters can be passed through registers, tables, or stacks, depending on the OS design.
- Types of System Calls:
- Process Control: Manage processes (create, terminate, allocate memory).
- File Management: Operations like file creation, deletion, reading, and writing.
- Device Management: Interacting with hardware devices.
- Information Maintenance: Managing system time, data, and attributes.
- Communication: Facilities for message passing and shared memory.
- Protection: Controls over access to resources and permissions.
Types of System Calls
- Process Control: Create, terminate, load, execute processes, manage memory, debugging.
- File Management: Create, delete, read, write files, manage file attributes.
- Device Management: Manage device interactions such as reading and writing.
- Information Maintenance: Set/get system data and attributes.
- Communication: Create communication channels for processes to interact.
- Protection: Manage access rights and user permissions.
System Programs
- Definition: Provide an environment for program development and execution, often serving as user interfaces to system calls.
- Examples:
- File manipulation utilities (create, delete, copy files).
- Status information tools (disk space, memory usage).
- Programming language support (compilers, assemblers).
- Communication tools (file transfer, messaging).
Operating System Design and Implementation
- Design Challenges: Operating systems must balance user goals (convenience, reliability) and system goals (efficiency, maintainability).
- Separation Principle: Distinguish between policies (what to do) and mechanisms (how to do it) to facilitate flexibility.
- Implementation: Historically, OS were built using assembly language, moving to C/C++. Current systems often combine languages for optimal performance and portability.
Operating System Structure
- Simple Structure: MS-DOS is an example, lacking modular division.
- Complex Structures: UNIX separates kernel and system programs.
- Layered Structure: Each layer builds on lower levels, from hardware up to user interface.
- Microkernel Structure: Moves many services to user space, increasing reliability and portability but potentially reducing efficiency.
- Modern Hybrid Systems: Combine aspects of multiple architectures to address performance, security, and usability needs (e.g., Mac OS X, Android).
Operating System Debugging
- Debugging Process: Involves creating logs and core dump files to diagnose failures.
- Performance Tuning: Identifying and eliminating bottlenecks to improve efficiency.
Operating System Generation
- Customization: OS needs to be tailored for specific hardware through system generation (SYSGEN) programs.
System Boot
- Boot Process: Initiated by executing code at a fixed memory location, commonly using a bootstrap loader (e.g., GRUB) to load the OS into memory and start execution.