Operating Systems
Operating Systems
An Operating System (OS) is system software that acts as an interface between the user and the
computer hardware. It manages hardware and software resources, providing services for computer
programs and enabling efficient execution of tasks.
1. Process Management
2. Memory Management
4. Device Management
1. Process Management
A process is a program in execution. The OS manages multiple processes using a technique called
multitasking, where it allocates CPU time to each process, allowing them to run seemingly
simultaneously.
Key Concepts:
Process Scheduling: Determines which process gets CPU time using algorithms like Round-
Robin, First-Come-First-Serve (FCFS), and Shortest Job Next (SJN).
Process States: Processes can be in states like Ready, Running, Waiting, or Terminated.
Context Switching: When the CPU switches from one process to another, it saves the current
process state and loads the new process state.
Example:
Imagine you are editing a document, playing music, and downloading a file simultaneously. The OS
ensures that each application gets CPU time without interrupting the others.
2. Memory Management
The OS manages the computer’s memory, both RAM (Random Access Memory) and virtual memory
(a portion of the hard drive used as temporary RAM). It allocates memory to processes and
deallocates it when it is no longer needed.
Key Concepts:
Segmentation and Paging: Techniques used to divide memory into segments or pages for
efficient use.
Virtual Memory: Allows the OS to use disk space as an extension of RAM, enabling
multitasking even when physical memory is low.
Example:
When you open a web browser, the OS allocates a portion of RAM to it. If the RAM is full, the OS uses
virtual memory, temporarily storing some data on the hard drive.
The OS manages files and directories on storage devices, providing a way to store, organize, and
access data.
Key Concepts:
File Systems: Common file systems include NTFS (Windows), ext4 (Linux), and APFS (macOS).
File Operations: The OS handles file creation, deletion, reading, writing, and searching.
Directory Structure: The OS organizes files into a hierarchical directory structure, making
data management easier.
Example:
When you save a document on your computer, the OS determines where the file will be stored on
the hard disk and updates the directory structure.
4. Device Management
The OS manages all hardware devices, such as keyboards, printers, and USB drives, using device
drivers, which are software components that allow the OS to communicate with hardware.
Key Concepts:
Input/Output (I/O) Operations: The OS handles data transfer between devices and memory.
Interrupt Handling: The OS manages interrupts, which are signals sent by devices indicating
they need attention.
Example:
When you plug in a USB drive, the OS uses the appropriate device driver to recognize it, making it
accessible for file operations.
5. Security and Access Control
The OS enforces security by controlling access to system resources, ensuring that only authorized
users and processes can perform certain actions.
Key Concepts:
Permissions: The OS assigns permissions to files and processes, restricting who can read,
write, or execute them.
Example:
On a Windows system, you might need administrator privileges to install new software, which
prevents unauthorized users from making changes to the system.
The OS provides a User Interface (UI) that allows users to interact with the computer. There are two
main types:
Graphical User Interface (GUI): Uses visual elements like windows, icons, and buttons (e.g.,
Windows, macOS).
Command-Line Interface (CLI): Uses text commands to interact with the system (e.g., Linux
Terminal, Windows Command Prompt).
Example:
When you click on an icon to open an application, the GUI sends a command to the OS to launch the
program.
1. Batch Operating System: Executes batches of jobs without user interaction (e.g., early IBM
mainframes).
2. Time-Sharing Operating System: Allows multiple users to use the system simultaneously
(e.g., UNIX).
3. Real-Time Operating System (RTOS): Provides immediate response to input (e.g., systems in
medical devices, automotive control).
4. Distributed Operating System: Manages multiple computers as a single system (e.g., Apache
Hadoop).
5. Mobile Operating System: Designed for mobile devices (e.g., Android, iOS).
Example: How the Operating System Manages a Simple Task
Let’s say you want to print a document from your word processor:
1. User Request: You click "Print." The GUI sends the request to the OS.
2. Process Scheduling: The OS schedules the printing process, deciding when it gets CPU time.
3. Memory Allocation: The OS allocates memory to hold the document data temporarily.
4. Device Communication: The OS communicates with the printer through its device driver.
5. File System Access: If the document is saved, the OS retrieves it from the file system.
6. Task Completion: Once printing is complete, the OS deallocates memory and updates the
process state.
2. Resource Management: Helps you understand how hardware resources like memory, CPU,
and storage are utilized.