To understand programming languages, one needs to know a bit about how a processor works. AProcessing Unit is that part of an integrated circuit chip that actually performs computations. It needs to read instructions, interpret them, and perform them. This is all done by a set of Logic Gatesimplemented by sets of transistors on the chip. Modern chips have up to 7 billion transistors or more than one billion logic gates.
- All electronic computation is controlled and computed by electronic signals passing in step through these logic gates.
- A processing unit instruction is a digital number that triggers a set of data to pass through a particular computation unit of the processor.
Each PU has some internal memory called registers, usually some dedicated to instructions and some to data (although they could be mixed). Here data and instructions are stored for quick access to the PU. So the PU goes through a cycle of:
- Read an instruction from main memory into registers (if not already available)
- Load an instruction from instruction queue
- Interpret instruction
- Perform instruction
- Leave results in specified location
- Return to step #1
Instructions to a processor are extraordinarily simple, each performing just one very specific, elemental task. They do things like:
Disclosure: The author is long AAPL.