Skip to main content

Multitasking

  • Timer Chip:: A timer chip can be programmed to trigger a switch to an OS interrupt handler after a certain period, allowing the OS to switch between processes

Hardware Interrupts (Process Switching)

  • OS schedulers: use timer chips like PITs for multitasking

    • The OS sets the timer chip to trigger an interrupt after a time period
    • When the timer elapses, it triggers a hardware interrupt, switching to kernel mode and jumping to OS code
    • The OS can save the current program's state, load a different program, and repeat
  • Performance Consideration: Too frequent task switching can reduce performance, as it requires saving and restoring program states

Timeslice Calculation

  • Timeslice: The duration an OS scheduler allows a process to run before preempting it
  • Fixed timeslice round-robin scheduling: Every process gets the same timeslice, and tasks cycle in order
  • Target Latency:: Setting an ideal maximum time for process response can optimize timeslice allocation