100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
C

Introduction to Operating Systems

Learn what an operating system is, why it exists, and how it mediates between hardware and applications.

Introduction to Operating SystemsBeginner8 min readJul 8, 2026
Analogies

Introduction

An operating system (OS) is system software that manages computer hardware and software resources and provides common services for application programs. It sits between the user/applications and the raw hardware, acting as an intermediary that hides the complexity of hardware devices while enforcing controlled, fair access to shared resources such as the CPU, memory, storage, and I/O devices.

🏏

Cricket analogy: Like an umpire standing between bowlers and batsmen enforcing the laws of the game, the OS sits between applications and hardware, translating raw physical action (the ball, the pitch) into fair, rule-governed play that both sides can trust.

Explanation

Without an OS, every application would need to talk directly to disk controllers, network cards, and the CPU scheduler itself — an unmanageable and dangerous proposition, since multiple programs would fight over the same resources. The OS provides two broad abstractions: (1) it acts as a resource manager, allocating CPU time, memory, and devices among competing processes; and (2) it acts as an extended/virtual machine, offering programmers a clean set of abstractions (files, processes, sockets) instead of raw registers and interrupts. Modern operating systems such as Linux, Windows, and macOS run in a privileged CPU mode (kernel mode) that ordinary applications (user mode) cannot access directly, forcing all hardware interaction to go through well-defined, safe entry points.

🏏

Cricket analogy: Without a central ground authority, every team would independently negotiate pitch access and umpiring decisions, causing chaos; the OS is like that central authority, acting as resource manager (allocating overs) and providing clean rules (LBW, no-ball) instead of raw physics.

Example

c
#include <stdio.h>
#include <unistd.h>

int main(void) {
    /* getpid() is a thin wrapper around a system call.
       The OS kernel, not the C library, actually knows
       the process ID -- the library just asks it. */
    pid_t pid = getpid();
    printf("This process is managed by the OS.\n");
    printf("My process ID (assigned by the kernel): %d\n", pid);
    return 0;
}

Output

Running this program prints a process ID such as 'My process ID (assigned by the kernel): 4821'. The exact number varies each run because the OS's process manager assigns IDs dynamically as processes are created and destroyed. This tiny example already demonstrates the OS acting as a resource manager: it is the sole authority that tracks which processes exist and hands out unique identifiers for them.

🏏

Cricket analogy: Each new player who walks out to bat is assigned a batting-order number by the team management on the spot, not pre-decided at birth, just as the OS's process manager dynamically hands out a unique process ID whenever a process is created.

Key Takeaways

  • An OS is the software layer between hardware and applications.
  • It acts both as a resource manager (CPU, memory, I/O) and a virtual/extended machine.
  • Hardware is only accessed safely through the OS via privileged kernel-mode code.
  • Examples of OS abstractions include processes, files, and sockets instead of raw hardware registers.
  • Even a trivial call like getpid() shows the OS quietly managing state on your program's behalf.

Practice what you learned

Was this page helpful?

Topics covered

#OperatingSystemsStudyNotes#OperatingSystems#IntroductionToOperatingSystems#Operating#Systems#Explanation#Example#StudyNotes#SkillVeris#ExamPrep