operating-systems

Definition

Instruction Trace

An instruction trace (or simply trace) is the actual sequence of machine code instructions executed by the processor for a given process (or a set of processes). It provides a detailed log of the process’s dynamic execution behaviour.

While a program’s code defines its static structure, the instruction trace captures its dynamic execution path, including branches, loops, and function calls.

Interleaved Execution

In a multitasking operating system, the CPU’s total instruction trace is an interleaving of the individual traces of all active processes. Traces are used to analyse processor behaviour by observing how these sequences overlap over time. The operating system (specifically the dispatcher) manages this interleaving to create the “illusion of parallelism.”

By switching between processes rapidly, the system ensures that multiple “train journeys” appear to progress simultaneously, even if only one “train” is moving at any specific instant on a single-core CPU.