Brain Dump

Assembly

Tags
language comp-arch

Is the lowest level programming language, excluding writing 0s and 1s exactly.

Each computer has an architecture with an associated assembly language. Each assembly language command has a 1:1 mapping to a set of 1s or 0s that tells the computer what to do. For example add BYTE PTR [0x20], 1 assembly instruction from x86 assembly adds 1 to the memory address 20.

Atomic Operations

Most modern architectures support atomic operations by prefixing the instruction with lock. For example lock add BYTE PTR [0x20], 1 adds 1 to the memory address 20 and makes sure only one processor or thread performs any of the intermediate steps to do so at a time.

Note: Atomic operations can be weak or strong. A strong instruction guarantees the success or failure, while weak may fail even when the operation succeeds. In general weak is faster.