CS452 - Real-Time Programming - Fall 2008

Lecture 8 - Scheduling


Questions & Comments

  1. Changing the GDT register

Scheduling

When to schedule

Whenever we leave the kernel. When do we enter the kernel?

  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 *name, 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

Choosing a Task ID

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: