Appendix

Processor

CPU

The CPU is the device that physically executes instructions to perform computation.

MMU

The MMU which stands for “Memory Management Unit”. Nowadays, is a component that intercepts every memory read or write coming from the program and remaps it from the virtual address to the physical main memory or processor cache. The MMU is also responsible for enforcing that programs only access the memory they have been given so that programs do not use other program’s memory.

Virtual Memory

Virtual memory is a way of isolating the memory used by different programs running on the same machine at the same time. Basically, each program sees a subset of total memory available on the machine. The process can only read or write address inside this space.

x86

By far the most common instruction set architecture for personal computers and servers. The instruction set architecture defines which instructions exist for the machine.

CPU

The CPU is the device that reads instructions, interprets the meaning, and performs the given computation. This is the component of the computer that implements all of the logic.

Instruction

A single low level step that the computer can execute. This is the pair of the operation along with the arguments to the operation.

Instruction Pointer

A special register which stores the address of the next instruction to execute. The programmer cannot directly manipulate this register.

Opcode

A particular operation that the computer can execute decoupled from the arguments. For example add or sub.

Register

A location to store a small value while performing operations. Except for mov, most instructions take registers for all inputs and outputs. Registers live on the CPU itself, not in memory.

Bitness

The number of bits in a value.

Word Size

The word size is the size of a register on the machine. However, “word” is often overloaded to mean 16 bit value. This comes from the fact that the original x86 processors were 16 bit. This is the root of the terms:

  • dword: double word, 32 bit value
  • qword: quadruple word, 64 bit value

mov

mov is the instruction that can load data from memory into a register or write data from a register back to memory.

Memory

Bit

The most primitive unit for storing information, either true or false. Bits are often denoted using 1 for true or 0 for false.

Byte

The smallest addressable number of bits. This is almost always eight bits.

Memory Management

Memory management is tracking which addresses are in use so that data is not overwritten while it is being used. This involves properly allocating and deallocating memory.

Allocation

To allocate memory is reserve a section of memory for some period of time.

Note

See Also

Deallocation

Deallocation

To deallocate memory is to mark that previously allocated region of memory is no longer needed and can be reused in the future.

Note

See Also

Allocation

Address

An address is an integer which corresponds to a location in memory.

Pointer

A pointer is a value that stores a memory address. This can either be the address of a single value, an array, or a struct.

Dereference

To “dereference” means to read the value stored at a particular address. For example, given memory that looks like:

memory = [1, 5, 3, 4, 5, 2, 8, 3]

Dereferencing address 4 (0-indexed) would be: memory[4] == 5.

Integer Width

The fixed number of bits in an integer. The common widths for integers are: 8, 16, 32, and 64.

Main Memory

Main memory, also just called “memory” or “RAM”, is ephemeral storage available to the processor for storing results of computations. This does not include persistent storage like hard drives.

Processor Cache

The processor cache is a series of caches that reside on the CPU itself. These caches are arranged from smallest and fastest to access to largest and slowest to access. The common naming convention is:

  • L1: smallest and fastest
  • L3 or L4 (depending on CPU): largest and slowest
  • LL: Last Level, always refers to the last level regardless of how many levels exist.

Often the L1 cache is split into two distinct caches: one for instructions and one for data.

LL

LL, short for “Last Level”, always refers to the largest and slowest memory cache level for a given machine.

Cache Line

A cache line is the unit of data transfer between main memory and the processor cache, or between levels of the cache. Instead of moving one byte at a time, movement is accelerated

Data Structures

Array

An array is an ordered sequence of values. The defining characteristic of an array is that the values are laid out next to each other in memory. For example if the elements are 4 byte integers, and the first element has an address of addr, then the second element will have an address of add + 4, the third element will have an address of addr + 8, and so on. The address of element n of any array a is a + sizeof(element) * n. Element n of array a is often denoted as: a[n].

Struct

A struct, short for “structure”, is a fixed-size collection of potentially unrelated types. In a structure, the elements are laid out in a fixed order, for example, imagine the struct:

{
    int32 a
    int8 b;
    int16 c;
}

The bytes could be laid out like:

[a[0], a[1], a[2], a[3], b[0], c[0], c[1]]

though, for alignment reasons it could also be laid out like:

[a[0], a[1], a[2], a[3], b[0], padding, c[0], c[1]]

where padding is a wasted byte that serves to make the address of c a multiple of 2.

Miscellaneous

Object

An object, in terms of object oriented programming, is a value paired with the set of operations that may be performed on the value.

Profiler

A profiler is a tool that tracks the execution of a program to better understand the behavior and performance of the program.