Understanding Kernel Execution and System Calls

how when the kernel runs n.w
1 / 8
Embed
Share

Explore how the kernel runs, from boot time to event-driven execution, along with insights into threads and system calls. Learn about the traditional view of process execution and the unique characteristics of the kernel in modern operating systems.

  • Kernel Execution
  • System Calls
  • Operating Systems
  • Event-Driven
  • Threads

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. How & When The Kernel Runs David Ferry, Chris Gill Department of Computer Science and Engineering Washington University, St. Louis MO davidferry@wustl.edu CSE 522S Advanced Operating Systems 1

  2. Traditional View of Process Execution Scheduled Ready Running Preempted Creation Terminate Unblocked Blocked Waiting However, the kernel is not traditional! CSE 522S Advanced Operating Systems 2

  3. Kernel Execution: Boot Bootloader loads kernel Initial kernel never returns Idle Task (pid 0) System Boot Initialize System Power On Creates Init, which creates all other threads The kernel only runs deterministically at boot time. Otherwise, the kernel is entirely event driven. ksoftirq Init (pid 1) migration Kernel threads are scheduled as any other process. Kernel entry point: start_kernel() in /init/main.c CSE 522S Advanced Operating Systems 3

  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 Systems 4

  5. Kernel Execution: Event Driven Software/hardware Interrupt arrives Hardware interrupt Returns control Runs in interrupt context Interrupt Handler Software interrupt Returns control Runs in syscall context Kernel preemption Interrupt context is unpreemptible Syscall context is preemptible (though may disable preemption) Return path may return control to kernel, userspace, or call schedule() CSE 522S Advanced Operating Systems 5

  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 Systems 6

  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 Systems 7

  8. Class Notes Please do studios in groups of 2 or 3 Meet in Urbauer 115 next time CSE 522S Advanced Operating Systems 8

More Related Content