Download presentation
Presentation is loading. Please wait.
Published byOwen Stokes Modified over 8 years ago
1
How & When The Kernel Runs David Ferry, Chris Gill Department of Computer Science and Engineering Washington University, St. Louis MO davidferry@wustl.edu 1CSE 522S – Advanced Operating Systems
2
Traditional View of Process Execution However, the kernel is not traditional! CreationReadyRunning Waiting Terminate Blocked Preempted Scheduled Unblocked 2CSE 522S – Advanced Operating Systems
3
Kernel Execution: Boot System Boot Initialize System Idle Task (pid 0) Creates Init, which creates all other threads ksoftirq Init (pid 1) migration The kernel only runs deterministically at boot time. Otherwise, the kernel is entirely event driven. Power On Bootloader loads kernel Initial kernel never returns 3CSE 522S – Advanced Operating Systems Kernel threads are scheduled as any other process. Kernel entry point: start_kernel() in /init/main.c
4
Kernel Execution: Threads Kernel threads perform background operations, e.g. – [ksoftirq] does delayed interrupt handling – [migrate] does inter-processor load balancing – [kworker] handles misc. tasks Kernel threads are almost just like user threads: – are scheduled – can be preempted – runs in kernel context – has no process memory space CSE 522S – Advanced Operating Systems4
5
Kernel Execution: Event Driven Runs in syscall context Interrupt Handler Runs in interrupt context 5CSE 522S – Advanced Operating Systems Software/hardware Interrupt arrives Returns control Hardware interrupt Software interrupt Returns control Interrupt context is unpreemptible Syscall context is preemptible (though may disable preemption) Return path may return control to kernel, userspace, or call schedule() Kernel preemption
6
System Calls The syscall interface is a single integer 1.User loads syscall number into register 2.May load syscall arguments into other registers 3.Executes syscall trap (software exception) 4.Trap is caught by the kernel 5.Puts arguments on kernel stack (asmlinkage) 6.Kernel looks up syscall number in the interrupt vector 7.Jumps to syscall routine specified in interrupt table CSE 522S – Advanced Operating Systems6
7
System Calls on ARM The syscall interface is a single integer 1.User loads syscall number into register R7 2.May load syscall arguments into R0-R6 3.Executes SWI instruction(software exception) 4.Trap is caught by the kernel 5.Control jumps to function vector_swi() in arch/arm/kernel/entry-common.S 6.Control eventually jumps to a C function inside the kernel CSE 522S – Advanced Operating Systems7
8
Class Notes Please do studios in groups of 2 or 3 Meet in Urbauer 115 next time CSE 522S – Advanced Operating Systems8
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.