operating-systems

Definition

OS Execution within User Processes

OS execution within user processes is an architecture where the kernel is mapped into the address space of every process. The OS exists as a privileged part of the process itself, not as a separate entity.

When a process requires an OS service (e.g., a system call), it performs a mode switch to kernel mode but remains within its own process context.

Mechanism

Shared Address Space

Each process has private user memory and a shared region containing the OS kernel.

Separate Stacks

The process uses a User Stack for application code and a dedicated Kernel Stack for OS routines.

Efficiency

A mode switch is faster than a process switch because TLB mappings need not be flushed when staying within the same process.

Properties

High Performance

Reduced switching overhead makes system calls fast.

Context Preservation

The process maintains its identity (PID, priorities) regardless of execution mode.

Analogy

Conductor's Cabin

The architecture resembles a conductor’s cabin on a train: the conductor (OS) performs duties within the train (process) without stopping the journey. The conductor uses the train’s own facilities rather than operating from outside.