修OSDI時,老師復習一個程式中,不同類型資料的儲存與定位方式。
Content
Sections
- Text Segment
- code (plain text), contains executable instructions
- place below the heap or stack in order to prevent heaps and stack overflows from overwriting it.
- sharable and readonly
- may be accessed by editor, compiler, shell, etc.
- Initialized Data Segment
- global variables and static variables
- not read-only
- initialized read-only area (ex. s[] = "hello world")
- initialized read-write area (ex. const char *string = "hello world")
- Uninitialzed Data Segment
- bss section: block started by symbol
- global variables and static variables that are initialized to zero or do not have explicit initialization in source code
- ex.
- static int i;
- [global] int j;
- Stack
- Heap
- dynamic memory allocation
Reference
No comments:
Post a Comment