Link to this heading32 bit
Link to this headingProgram Memory
When process switches in the CPU the memory gets unmapped and the new process gets remapped.
Linux Memory Map:
_________________________________
| Kernel Space | 0xffffffff |
| (1 GB) | - 0xc0000000 |
|______________|________________|
| | 0xbfffffff |
| User Mode | |
| Space (3 GB) | |
| | |
| | - 0x00000000 |
|______________|________________|
- Stack
- Local Variables
- Function Parameters
- Memory Mapping Segment
- File mapping including dynamic libraries
- Heap
- Runtime Memory allocation through malloc
- BSS Segment
- Uninitialized static variables
- Data Segment
- Variables Initialized by the programmer
- Text Segment
- Elf file of the process
Windows Memory Map:
_________________________________
| Kernel Space | 0xffffffff |
| (2 GB) | - 0x80000000 |
|______________|________________|
| User Mode | 0x7fffffff |
| Space (2 GB) | - 0x00000000 |
|______________|________________|
Link to this headingStack
Sample Program:
int
int