Purpose of An Operating System (OS) (Copy)
Chapter 16.1: Purpose of an Operating System (OS)
1. Introduction to the Operating System
- An Operating System (OS) is the essential system software that manages hardware and software resources.
- It acts as an interface between users and computer hardware.
- The OS provides a user-friendly environment to execute applications and manage system resources efficiently.
2. Key Functions of an Operating System
- Process Management
- Manages execution of processes and applications.
- Enables multitasking, allowing multiple processes to run simultaneously.
- Uses scheduling algorithms to allocate CPU time effectively.
- Memory Management
- Allocates and deallocates memory dynamically as required by running processes.
- Implements paging and segmentation to optimize memory utilization.
- Manages virtual memory when RAM is insufficient.
- File Management
- Organizes and controls file storage.
- Maintains a file system structure for efficient data access.
- Provides security through access control mechanisms.
- Device Management
- Controls input/output devices using device drivers.
- Allocates hardware resources to applications.
- Manages interrupt handling to prioritize tasks.
- User Interface
- Offers Graphical User Interface (GUI) and Command-Line Interface (CLI).
- Simplifies user interaction with system hardware.
3. Maximizing the Use of Computer Resources
- The OS ensures efficient utilization of system resources by managing:
- CPU Scheduling – Determines which process gets CPU time.
- Memory Optimization – Ensures memory is allocated properly.
- I/O System Management – Controls device communication.
- Direct Memory Access (DMA) Controller:
- Allows hardware to access memory directly without CPU involvement.
- Frees up CPU time for more critical tasks.
- Ensures smooth I/O operations.
4. OS Boot Process
- The BIOS (Basic Input/Output System) initializes system hardware.
- A Bootstrap program loads the OS into RAM from storage.
- Tablets and mobile devices use flash memory for quick startup.
- The OS is split into:
- Read-only memory (OS files) – Cannot be modified by users.
- User-accessible memory (apps and data) – Used for running applications.
5. Kernel and Core OS Components
- The Kernel is the core of the OS, handling:
- Process management
- Memory management
- Interrupt handling
- Device management
- File I/O operations
- Key Responsibilities of the Kernel:
- Communicates between hardware and software.
- Allocates CPU time and manages processes.
- Handles interrupts to maintain system stability.
6. User Interaction and System Simplification
- The OS simplifies hardware complexity using:
- Graphical User Interfaces (GUI)
- Device drivers for managing hardware interaction.
- File management tools for data access.
- Background utilities, such as virus scanning and system updates.
- Example:
- Older systems required manual command input for file transfers.
- Modern OS allows drag-and-drop functionality to perform the same task.
7. Process Management and Scheduling
- Multitasking: Allows multiple processes to run simultaneously.
- Scheduling Algorithms:
- Round Robin – Each process gets equal CPU time.
- First Come First Serve (FCFS) – Executes tasks in order of arrival.
- Shortest Job First (SJF) – Prioritizes shortest tasks.
- Shortest Remaining Time First (SRTF) – Prioritizes tasks with least time left.
- Preemptive vs. Non-Preemptive Scheduling:
- Preemptive: Allows process interruption for higher-priority tasks.
- Non-Preemptive: A process must complete before switching.
8. Process States and Control
- A process can exist in different states:
- Running: Executing on CPU.
- Ready: Waiting for CPU time.
- Blocked: Waiting for I/O operations.
- Process Control Block (PCB):
- Stores information about each process, including:
- Process ID
- CPU registers
- Memory allocations
- Scheduling priority
- Stores information about each process, including:
- Context Switching:
- Saves process state when switching between tasks.
- Ensures processes resume from the last execution point.
9. Memory Management Techniques
- Paging: Divides memory into fixed-size blocks.
- Uses a page table to map logical to physical addresses.
- Segmentation: Divides memory into variable-size blocks.
- Reduces internal fragmentation but may lead to external fragmentation.
- Virtual Memory: Uses disk storage to extend available RAM.
- Moves inactive processes to swap space to free up memory.
- Disk thrashing occurs when excessive swapping reduces system performance.
10. Interrupt Handling and Priority Levels
- The OS prioritizes tasks based on Interrupt Priority Levels (IPL).
- Example:
- IPL 31: Power failure (highest priority).
- IPL 24: System clock interrupts.
- IPL 20-23: I/O device interrupts.
- Example:
- Interrupt Handling Process:
- Interrupt is detected.
- The CPU stops the current process and saves its state.
- The OS looks up the Interrupt Dispatch Table (IDT).
- The required interrupt service routine (ISR) is executed.
- The previous process state is restored.
11. Security and System Protection
- The OS ensures data integrity, confidentiality, and security through:
- Access control (user permissions)
- Firewall and antivirus management
- Data encryption
- System updates and patches
- Process isolation to prevent unauthorized access
12. Benefits of an Operating System
- Simplifies user interaction through GUI and automation.
- Optimizes resource management for better system performance.
- Enhances multitasking capabilities.
- Improves security by preventing unauthorized access.
- Facilitates software execution across different hardware platforms.
