Scheduling and Synchronization



Semaphores



Synchronization Example

...
  lock(listmutex);
  list * p = listhead;
  while (p != NULL) {
    if (p->head >= 5) {
      int i = p->head;
      unlock (listmutex);
      return i;
    }
    p = p->next;
  }
  unlock (listmutex);
...



Pre-emption



Scheduler API



User-Level Scheduling



Real-Time Scheduling



Real-Time Scheduler



Earliest Deadline First