Lecture 003

CPU State

%esi, %edi: ???

Processor status register(s): EFLAGS

Floating point number registers: (still user register)

Execution environment: status registers and %eip

System Calls and Interrupts

getpid(): example system call

Kernel runtime language (CPU don't care which you use):

Kernel to Kernel, no switching stack

Kernel to Kernel, no switching stack

Trap Handler: job is to build kernel runtime environment

Trap: switching request from user code

Interrupt: switching request from hardware

There is a look up table involved for interrupt source storing CPU state - table base pointer established in OS startup - table entry size defined by hardware

Running: currently executing code Block: waiting for device (e.g. disk interrupt), can't run Runable: CPU is not scheduling for this code to run, but it can run

Race Condition Between Interrupt Handler and User Process

Race Condition Between Interrupt Handler and User Process

Solution: (1) temporary suspend/mask/defer device interrupt while checking and enqueue (2) lock-free data structure. But don't block all interrupt or for too long time.

Countdown Timer

Timer:

Table of Content