Layman's Guide to Computing

Articles in the Season 05 category

Issue 53: The CPU is an instruction-obeying slave

CPUs are unconscious slaves that simply execute instruction after instruction, at a very fast rate.

Published:

By J S Ng

Issue 54: Compiling programming code into CPU instructions

To get useful output from a CPU, we must translate the operations we want it to perform into CPU instructions, in a process known as compiling. Most compilers convert programming code into CPU instructions.

Published:

By J S Ng

Issue 55: Addressing memory

The life of the unconscious CPU is just executing instruction after instruction after instruction. Each instruction may consist of loading data from a memory location, sending data to a memory location, or performing operations on the data it is holding.

Published:

By J S Ng

Issue 56: Operating Systems and resource management

The operating system is responsible for listing and managing the computer’s resources, making them available to programs running on the computer, and making sure they only use what they are allowed to.

Published:

By J S Ng

Issue 57: Cache, the CPU’s working space

The CPU stores data for ready access in the CPU cache. Accessing data from the CPU cache is much faster than accessing data from memory. When the CPU needs data from a memory address, it looks in the cache first. If the data is not there (a cache miss), it will load the data from the memory address, and store a copy in the cache for faster reference in future. The CPU cache is managed by the CPU and is invisible to the OS. Programs that need to ensure the data in the cache is “fresh” can perform a cache flush and reload.

Published:

By J S Ng

Issue 58: CPU Optimisation Part 1 – Out-of-Order Processing

The CPU comprises different types of execution units. All the execution units can run at the same time, but they may execute instructions over different numbers of clock cycles. To minimise wait time, CPU instructions are carried out in an order that keeps the execution units busy as often as possible.

Published:

By J S Ng

Issue 59: Meltdown

A set of instructions can trick a CPU into reordering load instructions so that the data is temporarily loaded into the cache before the instructions are retired. The cache can then be snooped to retrieve the data.

Published:

By J S Ng

Issue 60: CPU Optimisation Part 2 – Speculative Execution and Spectre

Speculative execution is a feature that let’s the CPU speed up execution if it correctly predicts a decision point. The CPU carries out the operations along the predicted decision branch and loads the results if it predicts correctly.

Published:

By J S Ng

Issue 61: Mapping the cache

A cache miss is slow, and a cache hit is fast. This difference in cache reading speed can be used to transmit secrets out from the cache, which cannot be read directly by programs.

Published:

By J S Ng

Issue 62: Cache snooping

Published:

By J S Ng

Issue 63: Limitations of Meltdown and Spectre

For Meltdown and Spectre to work, they need two things: (1) Permission to carry out instructions (i.e. run programs) on the OS, and (2) knowledge of where the kernel address space is.

Published:

By J S Ng

Issue 64: Fixing Meltdown and Spectre

Meltdown and Spectre require the programs executing them to have access to kernel memory space. Kernel address isolation attempts to prevent the program from even having access to the kernel address space in the first place. TLB flushing changes the virtual-to-physical memory mapping, disrupting Spectre’s reliance on a consistent virtual-to-physical memory mapping.

Published:

By J S Ng

Issue 65: Memory Sharing in the Operating System

Shared memory helps to reduce the amount of memory needed by all the applications running on an operating system. It also allows applications to send data to each other, and to communicate.