A process is a program that is currently being executed on a computer.
It is almost the same as a task, which is the unit of work scheduled by the CPU.
When a program is loaded into memory, it becomes an instance of a process,
and then the CPU executes it according to the operating system's scheduler.
Memory Structure of a Process
When the OS allocates memory to a process, it follows this structure:
Stack and Heap (Dynamic Allocation)
Allocated at runtime.
- Stack: It stores local variables, parameters, and function call information, growing and shrinking as functions are called and return.
- Heap: It stores dynamically allocated data, such as objects and arrays.
Data Segment and Code Segment (Static Allocation)
Allocated at compile time.
- Data Segment:
- BSS Segment: Holds global/static/const variables initialized to 0 or uninitialized.
- Data Segment: Holds global/static/const variables initialized to non-zero values.
- Code Segment: Contains the program’s executable code.
'2025 > Operating System' 카테고리의 다른 글
Threads and Multithreading (0) | 2025.08.11 |
---|---|
PCB & Context Switching (0) | 2025.08.03 |
How memory manages data (0) | 2025.07.27 |
Memory (0) | 2025.07.25 |
Components of a computer (0) | 2025.07.22 |