Fundamentals 5 min read

The Origin of System Calls and Kernel/User Modes

In the 1950s programmers wrote directly to hardware, but the fragility of hard‑coded memory and I/O led to the invention of a privileged “expert” kernel mode and a restricted “novice” user mode, with a special instruction to switch, forming the basis of modern system calls and operating system protection.

Java Tech Enthusiast
Java Tech Enthusiast
Java Tech Enthusiast
The Origin of System Calls and Kernel/User Modes

In the 1950s programmers wrote code that ran directly on bare metal, managing CPU, memory, disks and peripherals themselves.

They could hard‑code physical memory addresses, control disk sectors, and read keyboard ports, e.g.:

mov ax, 0x1000    ; access physical memory 0x1000
mov [ax], 0x42    ; write data
in al, 0x60       ; read key from keyboard controller
mov [0x2000], al  ; store key
mov dx, 0x1F0     ; disk controller port
mov al, 0x20      ; read sector command
out dx, al        ; operate disk

Such tightly coupled code is fragile and non‑portable. To improve safety, the story proposes encapsulating hardware operations in a library and restricting direct hardware instructions.

The solution introduces two CPU states: “expert” (kernel) and “novice” (user). Only library functions run in expert state, while user code runs in novice state. Attempting privileged instructions in novice state triggers an exception.

A special instruction switches to expert state, for example:

int 0x80   ; switch to expert (kernel) mode
iret       ; return to novice (user) mode

This mechanism mirrors modern system calls and the distinction between kernel mode and user mode, effectively describing the birth of operating systems.

assemblyHardware AccessKernel ModeOperating Systemsystem call
Java Tech Enthusiast
Written by

Java Tech Enthusiast

Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.