OS Basics

Learn the fundamentals of OS

What is an Operating System?

The Operating System is the manager of a restaurant, who acts as the interface between the customers and the kitchen. Apps are customers, and hardware is the kitchen.

An Operating System is software that manages hardware resources and provides services to applications.

Example: Windows, Linux, macOS, Android, iOS

What is a Process?

A process is like a dish currently being cooked, its is active, using resources, and constantly changing.

A process is a running program currently being executed by the system.

Example: Opening Spotify, using a browser tab, running VS Code all these are separate processes.

Process Memory

Just like every dish being cooked has its own plate and ingredients, every process has its own memory space

Each process gets its own isolated memory space to prevent interference and corruption.

User Mode vs Kernel Mode

User mode is like the dining area where there is limited access, but our kernal mode is like the kitchen where all the cooking and modifying dishes is allowed.

User mode has limited acesss to the system whereas kernel mode has full system permissions.

System Calls

A system call is like placing an order through a waiter, apps request services via the OS.

System calls allow programs to interact safely with hardware through the OS.

Example: read(), write(), open(), fork(), exec()

Traps & Trap Handlers

When something unexpected happens, like dividing by zero, the OS steps in to decide what happens next.

A trap transfers control to the OS when exceptions or special events occur.