Instruction (Computer)

This is the fundamental building block of how a computer works.

The processor interprets

The main categories of Instructions

  1. Processor-memory: Data may be transferred from processor to memory, or from memory to processor.
  2. Processor-I/O: Data may be transferred to or from a peripheral device by transferring between the processor and an I/O module.
  3. Data processing: The processor may perform some arithmetic or logic operation on data.
  4. Control: An instruction may specify that the sequence of execution be altered. For example, the processor may fetch an instruction from location 149, which specifies that the next instruction be from location 182. The processor sets the program counter to 182. Thus, on the next fetch stage, the instruction will be fetched from location 182 rather than 150.

Taken from the OS book, page 33.

From Page 94: Today’s computers are built on two key principles:

  1. Instructions are represented as numbers.
  2. Programs are stored in memory to be read or written, just like data.

These principles lead to the stored-program concept; its invention let the computing genie out of its bottle.

I talk about this same idea in Von Neumann Architecture from Von Neumann Architecture from CS241E, “code is data”.

Figure 2.7 shows the power of the concept; specifically, memory can contain the source code for an editor program, the corresponding compiled machine code, the text that the compiled program is using, and even the compiler that generated the machine code.