Program
- Tags
- comp-arch
Is a sequence of instructions to be executed by a computer.
A program consists of:
- A binary format. This tells the OS about the various sections of the program binary, which parts are executable, constants, libraries to include, etc.
- A set of machine instructions.
- A number denoting which instruction to start from.
- Constants.
- Libraries to link and where to fill in the address of those libraries.
Execution Procedure
When your computer reads a program or data off the disk it:
- Sends a disk-read request to your disk controller.
- Waits for disk controller to signal the processor (the disk raises an interrupt) to let it know it's read the program into some location in memory.
- The processor can then use the bus to look at and execute the instructions in the read data.
Note: Unix always [see page 36, closes] all open file descriptors when a process is terminated.