Skip to content
All apps

Inside a CPU

About this app

Follow data between registers, ALU, caches, memory and storage. Explore cache misses, addition, DMA, memory protection and pipelining with cycle counts.

With explain mode: an AI tutor walks you through the app, points out what matters in the scene and answers your questions.

Computing is cheap, fetching data is expensive

A processor computes in its ALU with values from registers, which it reaches in one cycle. If the data is not there, it looks in the L1 cache (about 4 cycles), the L2 cache (about 12) and finally main memory, which takes around 200 cycles. Reading from an SSD costs about a million cycles and goes through the operating system and DMA. That is why caches and pipelines exist: they hide waiting time. The MMU translates virtual into physical addresses and stops a process from reading memory that belongs to another.

What the app shows

A 3D board with the CPU die, the pipeline stages IF, ID, EX, MEM and WB, a register file, ALU, L1 and L2 cache, an MMU with its page table, RAM banks, an SSD and a large cycle counter. Four scenarios run step by step: x = y + 2 with a cache hit and a cache miss, during which the ALU visibly waits about 200 cycles, and the addition as a chain of full adders; reading a file from the SSD via DMA; a foreign access that the MMU stops as a protection fault; and a pipeline that completes four instructions in 8 cycles instead of 20.

Try it yourself

Pick a scenario, step forwards and backwards or let it play automatically at an adjustable speed. Every step states its cycle cost, and a balance shows the cycles per memory level on a logarithmic scale. The camera can jump to the CPU, the ALU, the memory hierarchy, the MMU or the pipeline, or you can rotate the board freely.

Frequently asked questions

Why does a processor need a cache?
Because main memory is much slower than the CPU: a RAM access takes around 200 cycles, an L1 cache access about 4. The cache keeps recently used data close to the arithmetic unit. Without it the CPU would spend most of its time waiting for data.
What does the MMU do?
The memory management unit translates a program's virtual addresses into physical memory addresses using page tables. Because each process has its own translation, it cannot reach another process's memory; an attempt triggers a protection fault.
What does an instruction pipeline achieve?
A pipeline splits execution into stages such as fetch, decode, execute, memory access and write-back. While one instruction executes, the next is being decoded and the one after that fetched. Four instructions with five stages then take 8 cycles instead of 20.
What does the Inside the CPU app show?
Four scrubbable scenarios on a 3D board: an addition with cache hit and miss, an SSD read via DMA, a protection fault raised by the MMU and pipelining, each with a cycle counter and a cost balance per memory level.

Subject: Computer science

More from Computer science

A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps