Every computing system is composed of both hardware and software, for eg: applications (software) running on a smartphone (hardware). Computing systems can be run in parallel, through large networks of many computers, or they can also be run as a single computer. Our focus in this course will be on programming on a single computer.
The memory is stored in this linear array form, where each memory cell has an address (for example 0x0, 0x1, 0x2, … ), and the memory controller allows the CPU to access individual bytes in the memory.
Control instructions like branch allow us to jump back to a previous address.
For the sake of simplicity, let us assume that an instruction has a length of 4 bytes. Then, after an instruction is executed, the program counter increments by 4 bytes (the instruction length). The CPU itself only calls for the first address where the instruction begins. The memory controller then retrieves the whole instructions (4 bytes in our case) and then sends it to the CPU.
Simply put, a program is a sequence of instructions along with the necessary data.
The data can be:
In the OS kernel, there is a ‘loader’ which performs this function of preparing the program to be run and transferring control to the CPU. So then who loads the loader? It is the job of BIOS (Basic Input/Output System), the first software to run when the computer is turned on. The BIOS loads up the bootloader, which in turn eventually loads the operating system. From then on the OS kernel handles such operations. The BIOS is stored on non-volatile flash memory, and is only used once (during startup), then the OS kernel takes over.