What is an OS and how does it work?


π₯οΈ What is an OS and How Does It Work?
π Definition
An Operating System (OS) is system software that acts as an intermediary between computer hardware and the user. It manages hardware resources and provides a platform for applications to run.
β Tasks of an Operating System
Function | Description |
1. Process Management | Manages running processes, multitasking, and resource allocation. |
2. Memory Management | Allocates memory to programs and reclaims it after use. |
3. File System Management | Controls how data is stored and retrieved (read/write operations, file permissions). |
4. Device Management | Coordinates input/output devices (keyboard, disk drives, printers). |
5. Security & Access Control | Protects system data and user access rights. |
6. User Interface | Provides CLI or GUI for user interaction. |
π§± How an OS is Constructed (Architecture Overview)
An OS is typically divided into layers or modules, commonly including:
Kernel: Core part of the OS; manages hardware and system resources.
Shell: Interface between user and kernel (CLI or GUI).
System Libraries: Provide functions for programs to interact with the OS.
System Utilities: Tools for maintenance and control (e.g., Task Manager, Disk Cleanup).
π OS Construction Models:
Monolithic Kernel β All services run in one space (e.g., Linux).
Microkernel β Minimal kernel; services run in user space (e.g., Minix).
Hybrid Kernel β Mix of both (e.g., Windows, MacOS).
βοΈ Unix vs Linux vs Windows vs MacOS
Feature | Unix | Linux | Windows | MacOS |
Origin | 1970s (AT&T) | Unix-like (1991) | Microsoft (1985) | Apple (2001) |
Kernel Type | Monolithic | Monolithic | Hybrid | Hybrid |
Source Code | Closed/Varied | Open Source | Proprietary | Proprietary |
Security | High | Very High | Medium | High |
Customization | Limited | Highly customizable | Limited | Moderate |
Common Usage | Servers | Servers, Desktops | Desktops, Business | Creative/Design Work |
CLI Tools | Powerful | Extensive | Basic (PowerShell) | Unix-based (zsh, bash) |
π§± Operating System Architecture: Deep Dive
An OS is not a monolithic blockβit's a well-structured system built with different interacting layers, each responsible for a specific set of tasks. Here's a breakdown:
π§ 1. Kernel (The Core of the OS)
π What is it?
The kernel is the heart of the operating system. It directly interacts with the hardware and handles low-level operations like CPU scheduling, memory management, and device I/O.
π§ Functions:
Process scheduling
Memory allocation
Device communication
File system access
System calls handling
π§ͺ Example:
Linux Kernel β Manages everything from files to CPU cores.
Windows NT Kernel β Hybrid kernel that handles all hardware abstraction and low-level operations.
π¦ Types of Kernels:
Kernel Type | Description | Example OS |
Monolithic | All OS services run in kernel space. Faster but less secure. | Linux, Unix |
Microkernel | Minimal kernel. Most services (e.g., drivers, file system) run in user space. | Minix, QNX |
Hybrid Kernel | Combination of both. Offers balance. | Windows, macOS |
π 2. Shell (User Interface Layer)
π What is it?
The shell is the interface between the user and the OS kernel. It interprets user commands and passes them to the kernel for execution.
π‘ Types:
Command-Line Interface (CLI): Uses text commands (e.g., Bash, Zsh, PowerShell).
Graphical User Interface (GUI): Visual interface with icons and windows (e.g., GNOME, Windows Explorer).
π§ͺ Examples:
Bash Shell (Linux) β Most commonly used CLI shell.
Zsh (macOS) β Default interactive shell on modern Macs.
PowerShell (Windows) β Powerful scripting shell for Windows environments.
π 3. System Libraries
π What is it?
System libraries are collections of pre-written functions that applications use to interact with the OS without going through the kernel directly.
π Purpose:
Abstract complex system calls.
Provide standard APIs (Application Programming Interfaces).
π§ͺ Examples:
glibc (GNU C Library) β Standard library for Linux systems.
Win32 API β Used by Windows applications for GUI and system-level access.
π 4. System Utilities
π What is it?
These are user-facing tools that help in system maintenance, configuration, and monitoring.
π§° Types:
File utilities (e.g.,
cp
,mv
,ls
)Disk tools (e.g.,
df
,du
)Process tools (e.g.,
top
,htop
, Task Manager)
π§ͺ Examples:
Task Manager (Windows) β Monitor processes, memory, CPU.
Activity Monitor (macOS) β Same purpose as Task Manager.
htop (Linux) β Terminal-based process viewer.
𧬠Visual Overview of OS Architecture
sqlCopyEdit +---------------------------+
| System Utilities (GUI) |
| File Managers, Tools |
+---------------------------+
| System Libraries |
| API (e.g., glibc, Win32)|
+---------------------------+
| Shell |
| Bash, Zsh, PowerShell |
+---------------------------+
| Kernel |
| Memory, Process, Device |
+---------------------------+
| Hardware (CPU, RAM, Disk, I/O Devices) |
+---------------------------------------------+
π§ Real-World Example Flow (Command Execution)
Letβs say you run this command in a Linux terminal:
bashCopyEditls -la /home
Here's what happens:
Shell interprets the command.
It sends a system call through the system library (glibc).
The kernel receives the request and interacts with the file system on disk.
Results are passed back up through the system library to the shell.
You see the output in your terminal.
Subscribe to my newsletter
Read articles from M. T. H. Titumir directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

M. T. H. Titumir
M. T. H. Titumir
π Curious mind | Problem solver π Learning & creating π Observing the world, one thought at a time