Notes - MIECT
Sistemas De Operação
Notes - MIECT
Sistemas De Operação
  • Sistemas de Operação
  • Processes in Unix/Linux
    • Process
    • Multiprocessing vs. Multiprogramming
    • Processes in Unix
    • Execution of a C/C++ program
  • Introduction to operating systems
    • Global view
    • Evolution of computational systems
    • Key topics
  • Semaphores and Shared memory
    • Concepts
    • Semaphores
    • Shared memory
    • Unix IPC primitives
  • Threads, mutexes and condition variables in Unix/Linux
    • Threads
      • In linux
    • Monitors
    • Unix IPC primitives
  • Processes
    • Process
      • Diagrams
    • Process control table
    • Context switching
    • Threads
  • Processor Scheduling
    • Processor Scheduler
    • Short-term processor scheduler
    • Scheduling algorithms
    • Scheduling criteria
    • Priorities
    • Scheduling policies
      • In Linux
  • Interprocess communication
    • Concepts
    • Philosopher dinner
    • Access primitives
      • Software solutions
      • Hardware solutions
    • Semaphores
    • Monitors
    • Message-passing
    • Unix IPC primitives
  • Deadlock
    • Introduction
    • Philosopher dinner - Solution 1
      • Deadlock prevention
    • Philosopher dinner - Solution 2
      • Deadlock prevention
    • Philosopher dinner - Solution 3
      • Deadlock prevention
    • Philosopher dinner - Solution 4
    • Deadlock avoidance
    • Deadlock detection
  • Memory management
    • Introduction
    • Address space
    • Contiguous memory allocation
    • Memory partitioning
    • Virtual memory system
    • Paging
    • Segmentation
    • Combining segmentation and paging
    • Page replacement
      • Policies
    • Working set
    • Thrashing
    • Demand paging vs. preparing
Powered by GitBook
On this page
  1. Processes

Context switching

Current processors have two functioning modes:

  • supervisor mode – all instruction set can be executed.

    • is a privileged mode.

  • user mode – only part of the instruction set can be executed.

    • input/output instructions are excluded as well as those that modify control registers.

    • it is the normal mode of operation.

Switching from user mode to supervisor mode is only possible through an exception (for security reasons).

An exception can be caused by:

  • I/O interrupt.

    • external to the execution of the current instruction.

  • Illegal instruction (division by zero, bus error).

    • associated with the execution of the current instruction, but not intended.

  • Trap instruction (software interruption)

    • associated with the execution of the current instruction, and intended.

The operating system should function in supervisor mode.

  • in order to have access to all the functionalities of the processor.

Thus kernel functions (including system calls) must be fired by:

  • hardware (interrupt).

  • trap (software interruption).

This establishes a uniform operating environment: exception handling.

Context switching is the process of storing the state of a process and restoring the state of another process.

Context switching occurs necessarily in the context of an exception, with a small difference on how it is handled.

Processing a (normal) exception

PreviousProcess control tableNextThreads

Last updated 2 years ago