Operating Systems
CS 273 (OS), Fall 2020
(Version 5.0.21)
Process table
The process table is called
task_struct, and is defined intask_struct.
Scheduler; context switching
The scheduler is called
schedule(), defined inschedule.sched_submit_work()updates Linux's bookkeeping to prevent I/O deadlocks if a process is becoming blocked. Deadlock means that there is a collection of processes, each blocked waiting for an event that can only be caused by another process in that collection. (Will study deadlocks later.)__scheduleperforms more deadlock prevention (preemp_disable()) and some IPC operations ("read/copy/update" synchronization operationrcu_note_context_switch(),raw_spin_lock_irq(), etc.), then callscontext_switchswitch_toincludes some of the register movements, saving from outgoing process and obtaining values for incoming process.Paravirtualization -- for making low-level tweaks of kernel for bare hardware vs. a virtual machine.
arch_start_context_switchimplemented usingPVOP_VCALL1()macro, which is ultimately defined in terms of another macro____PVOP_CALLimplemented using assembly calls.Macro
prepare_arch_switch- insures that a specific assembly-level computation doesn't get optimized away by compiler, by inserting an empty computation that won't be "crossed" by optimization rewriting.