CS452 - Real-Time Programming - Spring 2008
Lecture 13 - Task IDs, Debugging
Questions & Comment
- 386 processor manual
- Section 10.4.1 of above is typical (and hilarious, but only if you are
in the right mood).
- Real address mode versus protected mode
Task IDs
Create
Pid = Create( char *code, int priority )
Return value might be an error
- out of task descriptors or memory
- not a pointer to an ELF executable
- not a valid priority
Create is a stub
- set up arguments for kernel
- enter kernel
- on return, retrieve return value from where kernel put it
- put it in the right place for return from function call.
What to do in the Kernel
1. Check priority
2. Get a free task descriptor (TD)
3. Initialize TD
- task state
- parent Pid
- priority
- other stuff not yet initializable
4. Define the Pid
5. Allocate segment for the stack
- set the stack pointer: SS, ESP
6. Choose PSW
7. Find code segment
- push CS and EIP onto stack
8. Add task to priority queues
9. Set return value to Tid
10. Put SS, ESP in TD
Items 6 through 10 need to be considered together taking into account how
the context switch is done.
Task ID
What it needs
- Unique, even after task is destroyed
- Easy to generate
- Easy to find the TD
Good enough for CS452, even with destroy
- 16 bit number
- Divide into two parts
- index into table of TDs
- generation number
Debugging
Printf
Graphics Output
GRUB
Breakpoint
Autopsy
Could be Breakpoint starting when you do NMI
Gossip
History buffers
Use Bits
The Trace Bit
Return to: