Machine Language and Memory - Nand2Tetris
The language of computer gods.
Some of the quotes and information are part of the Nand2Tetris course available on Coursera.
The Machine Language is the most important interface of a computer. It specifies the interaction between the hardware and the software of the computer. Wasn't this the kernel? Well theoretically yes but the Linux kernel is written in C and Assembly which is converted to Machine Language.
Machine Language is in Binary and they directly correspond to the hardware implemented in the computer. For instance, if the hardware has an implementation for Addition, there is a binary code for that operation.
Because Machine Language directly corresponds to the hardware implementation of a computer, so there are two things that can change in a Machine Language:
- Set of operations available. (Division, Bulk Copy, etc.)
- Data Types (Register Width, Floating Point, etc.)
Fast memory is expensive, large memory is slow. For this reason, we have a memory hierarchy. We arrange faster and small memory close to the CPU and slow and large memory farther from the CPU.
This solves 2 problems:
- Need to supply long memory address
- Getting the memory contents of the CPU
Computers execute commands and operations in a sequence. To control the sequence in which operations are performed or to repeat the same operations again and again, we use Conditional and Unconditional jumps.