Sunday, February 23, 2014

[OSDI] Memory Layout

修OSDI時,老師復習一個程式中,不同類型資料的儲存與定位方式。

Content

Sections

  1. 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.
  2. 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")
  3. 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;
  4. Stack
  5. Heap
    • dynamic memory allocation

Reference


No comments:

Post a Comment