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

FunctionDescription
1. Process ManagementManages running processes, multitasking, and resource allocation.
2. Memory ManagementAllocates memory to programs and reclaims it after use.
3. File System ManagementControls how data is stored and retrieved (read/write operations, file permissions).
4. Device ManagementCoordinates input/output devices (keyboard, disk drives, printers).
5. Security & Access ControlProtects system data and user access rights.
6. User InterfaceProvides 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

FeatureUnixLinuxWindowsMacOS
Origin1970s (AT&T)Unix-like (1991)Microsoft (1985)Apple (2001)
Kernel TypeMonolithicMonolithicHybridHybrid
Source CodeClosed/VariedOpen SourceProprietaryProprietary
SecurityHighVery HighMediumHigh
CustomizationLimitedHighly customizableLimitedModerate
Common UsageServersServers, DesktopsDesktops, BusinessCreative/Design Work
CLI ToolsPowerfulExtensiveBasic (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 TypeDescriptionExample OS
MonolithicAll OS services run in kernel space. Faster but less secure.Linux, Unix
MicrokernelMinimal kernel. Most services (e.g., drivers, file system) run in user space.Minix, QNX
Hybrid KernelCombination 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:

  1. Shell interprets the command.

  2. It sends a system call through the system library (glibc).

  3. The kernel receives the request and interacts with the file system on disk.

  4. Results are passed back up through the system library to the shell.

  5. You see the output in your terminal.

0
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