CS452 - Real-Time Programming - Spring 2010

Public Interest Announcements

  1. Partners

Lecture 8 - Scheduling, Create( )

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

How to implement the queues

one sorted queue


Tid Create( int priority, void (*func) ( ) )

You also need a Tid Create( int priority, void (*code) ( ) ) function to call from user tasks.

Although it's no more than a wrapper there are a few problems to solve.

  1. Passing arguments
  2. Jumping into the kernel
  3. Getting the return value from the kernel and returning it.

Other Primitives

These primitives exist mostly so that we can ensure that task creation and scheduling are working when there is not much else implemented.

Tid MyTid( )

Self-explanatory

A question, to which there is a correct answer, or more specifically, a correct (answer, reason) pair.

Tid MyParentTid( )

Self-explanatory

Where is the parent Tid, and how does the kernel find it?

void Pass( )

Doesn't block: task calling Pass( ) remains ready to execute.

Does reschedule.

When is Pass( ) a NOP?

void Exit( )

Calling task is removed from all queues, but its resources are not reclaimed or reused.

That is, the task goes into a zombie state, in which it cannot be active or ready, but continues to own all its resources.

How Should Execution Terminate?


Return to: