Definition
An Operating System (OS) is system software that manages computer hardware and software resources and provides a platform for running application programs.
Examples of Operating Systems
- Microsoft Windows
- Linux
- macOS
- Android
- iOS
2. Purpose of an Operating System
The main purpose of an operating system is to make the computer system easy to use and to efficiently manage its resources.
Objectives (Purpose)
- Provide an interface between the user and hardware.
- Manage CPU, memory, files, and input/output devices.
- Execute application programs.
- Ensure efficient utilization of system resources.
- Provide security and protection.
- Support multitasking and multiprocessing.
- Detect and handle errors.
3. Functions of an Operating System
- Process Management
- Creates, schedules, and terminates processes.
- Allocates CPU time to processes.
- Memory Management
- Allocates and deallocates memory.
- Protects memory used by different programs.
- File System Management
- Creates, deletes, and organizes files and directories.
- Device Management
- Controls input/output devices using device drivers.
- Security and Protection
- Prevents unauthorized access.
- Manages user accounts and permissions.
- Resource Allocation
- Distributes CPU, memory, storage, and devices among programs.
4. OS Structure
An operating system consists of different components that work together to manage the computer.
+-----------------------------+
| User Programs |
+-----------------------------+
| System Call Interface |
+-----------------------------+
| Operating System |
|-----------------------------|
| Process Management |
| Memory Management |
| File Management |
| Device Management |
| Security |
+-----------------------------+
| Computer Hardware |
| CPU | Memory | I/O Devices |
+-----------------------------+
Components of OS Structure
- Kernel – The core part of the OS that manages hardware and system resources.
- Shell – The user interface (CLI or GUI) that accepts user commands.
- System Calls – Allow application programs to request services from the operating system.
- Device Drivers – Enable communication between the OS and hardware devices.
- File System – Organizes and stores files on storage devices.
5. OS Operations
An operating system performs various operations to manage hardware and software efficiently.
A. Dual-Mode Operation
Modern operating systems operate in two modes to provide security and stability.
1. User Mode
- Applications run in this mode.
- Programs have limited access to hardware.
- Cannot directly access memory or I/O devices.
- Safer because errors in user programs do not crash the entire system.
2. Kernel Mode (Supervisor Mode)
- Operating system runs in this mode.
- Has full access to CPU, memory, and hardware.
- Executes privileged instructions.
- Can perform system-level operations.
Diagram
+----------------------+
| User Mode |
| (Application Program)|
+----------------------+
|
System Call
|
v
+----------------------+
| Kernel Mode |
| Operating System |
+----------------------+
|
v
Hardware Devices
Advantages of Dual Mode
- Improves system security.
- Prevents unauthorized hardware access.
- Protects the operating system from faulty applications.
- Increases system reliability.
B. Multi-Mode Operation
Some advanced processors support multiple execution modes, each with different privilege levels.
Common Modes
- User Mode
- Kernel Mode
- Hypervisor Mode (used for virtualization)
- Virtual Machine Mode
- Secure Mode (used in secure processors)
Advantages
- Better security.
- Supports virtualization.
- Efficient management of multiple operating systems.
- Improved resource isolation.
6. Operating System as Resource Manager
The operating system acts as a Resource Manager because it controls and allocates all computer resources efficiently.
Resources Managed by the OS
- CPU
- Main Memory (RAM)
- Hard Disk / SSD
- Files
- Printers
- Keyboard
- Mouse
- Network Devices
Responsibilities
CPU Management
- Schedules processes.
- Allocates processor time.
Memory Management
- Allocates memory.
- Frees unused memory.
- Prevents memory conflicts.
File Management
- Creates, deletes, and organizes files.
- Controls file access permissions.
Device Management
- Controls I/O devices.
- Coordinates communication through device drivers.
Process Management
- Creates and terminates processes.
- Synchronizes and schedules execution.
Resource Management Diagram
User
|
v
+-----------------------+
| Operating System |
+-----------------------+
| CPU Management |
| Memory Management |
| File Management |
| Device Management |
| Security |
+-----------------------+
|
v
+-----------------------+
| Computer Resources |
| CPU RAM Disk Printer |
| Keyboard Mouse etc. |
+-----------------------+
Advantages of Operating System
- Easy interaction between user and hardware.
- Efficient resource utilization.
- Supports multitasking.
- Provides security and protection.
- Improves overall system performance.
- Simplifies application development.
