CS452 - Real-Time Programming - Fall 2008
Lecture 13 - Interrupts
Questions & Comments
Low-level primitive
This is what everything depends on
int AwaitEvent( int EventType );
What does it do?
- Blocks on an interrupt of the type specified
- When the interrupt occurs, may return one word of volatile data
Implementation notes
- Event may already have occurred
- AwaitEvent( ) can service the device.
- Then it must return the volatile data
- Need to think of priorities when you partition the work
- Kernel has interrupts turned off
- Therefore need
IdleTask( ). Why?
How is it used?
Example: Clock Server
Provides a sleep prinitive
int Delay( int interval )
- block and return later
- Send to a server which
- maintains an ordered list of sleepers
- receives clock ticks
- on each tick checks the list and replies to each sleeper who is
ready to wake up
- Server must receive clock ticks
What does the kernel do?
Processor
- INT pin
- runs one or more bus cycles to find the vector of the interrupt
- puts CS, EIP, FLAGS of interrupted task on stack
- retrieves new CS, EIP, FLAGS (with interrupts disabled) from IDT
- begins executing ISR
- when ISR is complete, IRET
- pops CS, EIP, FLAGS from stack
- puts them into the processor
- `interrupted' process continues
Software
- gets volatile data from device
- turns off source of interrupt
- finds task waiting on the interrupt
- makes it ready
Return to: