CS452 - Real-Time Programming - Spring 2008

Lecture 11 - Scheduling


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

Scheduling

When to schedule

  1. Tasks run to completion
  2. Event-driven pre-emption
  3. Time-slicing

Who to Schedule

  1. active task decides = co-processes
  2. round robin
  3. priorities
    1. fixed at compile time
    2. fixed when task is created
    3. re-fixed every time task is scheduled
      • Do you have a good algorithm
  4. hybrid
  5. determined by type of kernel entry

What God has Decided

Hybrid

What you decide

  1. How many priorities
  2. Which task should have which priority
  3. How to implement the queues

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


Return to: