CPU Abstraction: the Process

  • Mechanisms: low-level machinery

    • E.x. Time-sharing mechanism

    • "How"

  • Policies: algorithms for making some kind of decision within the OS

    • E.x. Scheduling policy

    • "Which"

  • Separating the two allows one easily to change policies without having to rethink the mechanism and thus is a form of modularity.

4.1 The Abstraction: A Process

  • The abstraction provided by the OS of a running program is something we will call a process.

  • What constitutes a process (its machine state)

    • Memory (address space): instructions, data (read, write)

    • Registers: program counter (PC), stack pointer, frame pointer

    • Persistent storage devices

4.2 Process API

  • Create, destroy, wait, miscellaneous control, status

4.3 Process Creation: A Little More Detail

  • Load the code and static data from disk into memory

  • Creating and initializing a stack

  • Doing other work as related to I/O setup

  • Start the program running at the entry point

4.4 Process States

  • Running: on a processor, executing instructions

  • Ready

  • Blocked

4.5 Data Structures

  • Process list

For each process

  • Registers (save and restore)

  • State of the process, ID

  • Parent process

  • Open files

  • Current directory

  • Process memory (start, size)

  • Bottom of the kernel stack

  • Trap frame for the current interrupt

Last updated