Courses/Computer Science/CPSC 457.F2013/Lecture Notes/ProcAddrSpace

Jump to: navigation, search

The Process Address Space

In which we discuss the organization of the memory regions of a process.

We will look at how to create, share, and delete a process address space, how to define the memory regions that compose it, and how to manage the heap. We will examine the kernel's support for page tables, memory pages, and how to associate them with a process.

We will draw our material from MOS Chapter 3 and LKD Chapter 15

Lecture Notes

  • pmap(1)
  • vmmap (OS X)
  • vm_stat (OS X)

Kernel Code Links

Below I provide links to the version of the kernel; more recent versions have slight differences in their fields.

The mm_struct declared inside task_struct (note mm and active_mm)

The actual type definition of mm_struct.

The type definition of vm_area_struct

The mprotect system call entry point. This is an example of using these vm area structure fields and properties (particularly the flags).

The allocation routine for the page table directory


Linux memory regions (struct vm_area_struct)

  • recall kernel / userland split
    • kernel typically starts at physical address 0x00100000 (from the 2nd MB - note that this is a hex address, not a binary address; 1 x 16^5)
      • _text (start of kernel code)
      • _etext (end of kernel code)
      • _etext+1 is start of initialized data
      • _edata (end of initialized data)
      • _edata+1 (start of uninitialized data)
      • _end (end of uninitialized data)
    • but the logical address is the "top" 1 GB of RAM (0xc0000000 to 0xffffffff)
    • userland is thus in logical addresses 0x00000000 to 0xbfffffff (and if we remember what stack addresses look like from gdb, and that the stack typically grows "down" toward zero on x86, this makes sense)

Scribe Notes


  • MOS: 3.1 "No Memory Abstraction"
  • MOS: 3.2 "A Memory Abstraction: Address Spaces"