Notes on “Mechanism: Limited Direct Execution”

Architecture must support (at least) two modes of operation:

  • Mode is indicated by a status bit in a protected control register
  • User programs execute in user mode
  • OS executes in kernel, privileged mode (OS == “kernel”)

User mode

code that runs in user mode is restricted in what it can do. For example, when running in user mode, a process can't issue I/O requests; doing so would result in the processor raising an exception; the OS would then likely kill the process.

Kernel mode

In contrast to user mode is kernel mode, which the operating system (or kernel) runs in. In this mode, code that runs can do what it likes, including privileged operations such as issuing I/O requests and executing all types of restricted instructions.

  • In user mode, applications do not have full access to hardware resources.
  • In kernel mode, the OS has access to the full resources of the machine.

System call

We are still left with a challenge, however: what should a user process do when it wishes to perform some kind of privileged operation, such as reading from disk? To enable this, virtually all modern hardware provides the ability for user programs to perform a system call.

Events

  • An event is an unnatural change in control flow
  • Two kinds of events, interrupts and exceptions
  • Interrupts are caused by an external event
  • Exceptions are caused by executing instructions

Leave a Reply