CS452 - Real-Time Programming - Fall 2010

Lecture 8 - Scheduling, Create( )

Pubilic Service Announcements

  1. Re-organized web pages
  2. Performance criteria for the kernel
  3. -3 return value doesn't make sense


When to schedule

When does the OS enter the kernel?

Possible times

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

When do we leave the kernel?

If we are blocked,

Therefore, when we are not blacked

Who to Schedule

Whoever is needed to meet all the deadlines

Cheap (=constant time)ways 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

In cs452


What you decide

  1. How many priorities
  2. Which task should have which priority
  3. What to do when there is no ready task

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( )


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

Tid MyParentTid( )


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?


If you go back to RedBoot

Return to: