Search Suggest

Posts

Operating System Software

Operating System Software + Linux Internals
Complete Explanation

1. What is an Operating System?

An operating system (OS) is the most important system software that runs on your computer, phone, tablet, or any computing device.

Think of it this way:

  • Hardware = the body (CPU, RAM, disk, screen, keyboard…)
  • Applications = the things you actually want to do (Chrome, WhatsApp, games, Word…)
  • Operating System = the brain + manager + translator that makes everything work together

Without an OS, the hardware is just useless parts — you cannot easily use the computer.

Simple Analogy

The operating system is like the government of a country:

  • Makes rules (how programs behave)
  • Allocates resources (CPU time, memory, disk space)
  • Provides services to apps/programs
  • Controls security (permissions, firewall)
  • Builds communication (file system, networking, drivers)

2. Main Jobs of an Operating System

Function What it does Everyday Example
Process Management Creates, runs, pauses, stops programs You open 15 tabs + Spotify + Word at once
Memory Management Gives programs RAM, prevents crashes Apps don't steal each other's memory
File System Organizes, stores, finds files & folders Creating Desktop → Downloads → NewFolder
Device Management Controls hardware via drivers Plug in pen drive → it just works
User Interface GUI or terminal interaction Windows desktop, Android home screen

3. Linux Internals – Deep Dive

3.1 Overall Linux Architecture

+---------------------------+  
|     User Space            |  
|  Applications   Shell     |  
|     Libraries (glibc…)    |  
+---------------------------+  
          │   System Call Interface
          ▼
+---------------------------+  
|     Kernel Space          |  
|       Linux Kernel        |  
|  (monolithic + modular)   |  
|  Process • Memory • FS    |  
|  Drivers • Networking     |  
+---------------------------+  
          │   Hardware
          ▼
+---------------------------+  
|       Hardware            |  
| (CPU, RAM, Disk, NIC...)  |  
+---------------------------+

3.2 Process & Thread Model

User Process (PID 1234)
   │
   ├─ Thread 1 (LWP 1234)  ← main thread
   ├─ Thread 2 (LWP 5678)
   └─ Thread 3 (LWP 9012)

   Shared: address space, file descriptors, signals
   Per-thread: stack, registers, TLS

3.3 Memory Management Layers

User Virtual Address Space (per process)
┌───────────────────────────────────────────────┐
│ 0x0000000000000000                            │
│       Text (code)                             │
│       Data + BSS                              │
│       Heap   (grows ↑)                        │
│       Memory-mapped / shm                     │
│       Stack  (grows ↓)                        │
│ 0xffffffffffffffff                            │
└───────────────────────────────────────────────┘

Kernel manages: Buddy, Slab, Page cache, Swap, THP, NUMA

3.4 System Call Flow

User: write(fd, buf, len)
      │
      ▼
syscall(SYS_write, ...)
      │
      ▼
Kernel: sys_write()
      │
      ▼
fd → file → dentry → inode → superblock
      │
      ▼
VFS → filesystem → page cache → block layer → disk

4. Quick Reference Table – Linux Internals

Area Key Mechanism Commands to Explore
Process fork, clone, execve ps aux, top -H, /proc/<pid>
Memory Demand paging, COW, TLB cat /proc/meminfo, vmstat
File System VFS layer df -h, ls -i, findmnt
Scheduler CFS (Completely Fair Scheduler) chrt, nice, /proc/sched_debug

Reference material – Feel free to share or use for learning!

Post a Comment