[Day 2] 3. Process Management
!3. ProcessManagement.png
Process: Running an instance of a program.
Program: A set of instructions for the machine (CPU).
Compilation Process
The compilation process involves converting source code into machine code. This is achieved through a compiler, which is also known as a toolchain.
Toolchain Components
A typical toolchain consists of the following components:
- Pre-processor: Processes preprocessor directives and removes comments from the source code.
- Compiler:
- Checks for syntax errors and informs the programmer if any errors are found.
- Converts expanded source code to assembly code.
- Assigns addresses to variables and functions.
- Creates a symbol table that stores information about symbols, which include the program's functions and variables.
- Assembler: Converts assembly code into machine code.
- Linker:
- Combines the generated machine code with library machine code to create an executable file.
- Adds an executable header containing information about the program.
- Debugger: Helps identify and fix bugs in the code.
Example: GCC Toolchain
The GCC (GNU Compiler Collection) is a widely used toolchain for converting C code into machine code. Its components include:
- Pre-processor: CPP
- Compiler: CCI
- Assembler: AS
- Linker: LD
- Debugger: GDB
Machine Code Generation
- The final output of the tool-chain is machine code, which is in binary format.
- This machine code is organised into sections, hence referred to as sectioned binary.
- The sectioned binary is stored on the hard disk.
Read Next
[Day 2] 4. Executable File
!4. Executable File.png ### **Executable File Structure** An executable file contains several key sections, each serving a specific purpose:...
[Day 2] 5. Process Life Cycle
!5. Process Life Cycle.png The **5-state process model** is commonly used in operating systems to describe the various states a process can be in d...