CS452 - Real-Time Programming - Spring 2008

Lecture 13 - Task IDs, Debugging


Questions & Comment

  1. 386 processor manual
  2. Section 10.4.1 of above is typical (and hilarious, but only if you are in the right mood).
  3. Real address mode versus protected mode

Task IDs

Create

Pid = Create( char *code, int priority )

Return value might be an error

  1. out of task descriptors or memory
  2. not a pointer to an ELF executable
  3. not a valid priority

Create is a stub

  1. set up arguments for kernel
  2. enter kernel
  3. on return, retrieve return value from where kernel put it
  4. 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

4. Define the Pid

5. Allocate segment for the stack

6. Choose PSW

7. Find code segment

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

  1. Unique, even after task is destroyed
  2. Easy to generate
  3. Easy to find the TD

Good enough for CS452, even with destroy

  1. 16 bit number
  2. Divide into two parts

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: