RTS: Scheduling Period Tasks

RTS: Priority-based Scheduling

Review: In the last two lectures we discussed realtime scheduling of periodic tasks. We studied an approach to design a static schedule and implemented a cyclic executive based on that schedule.

Below is the outline for today's lecture. Get more deatils in class.

Rate monotonic scheduling (RMS): Lui Sha

Periodic tasks are prioritized by the frequency of repetition (high priority to tasks with shorter periods). Higher the frequency of the task higher the priority.
Preemptive scheduling is commonly used.
Schedulability according to RMS

Σ(Ci/Ti) <= n(pow(2,1/n)-1)

Priority Based Scheduling

Tasks are assigned priority according to their characteristics. One or more resources may be shared among the tasks/processes. This poses additional problems like deadlock. Before we study the scheduling process, we need to understand the definition of a task or a process. Lets do that. We will use the term "process" for representing a realtime task.

Process: Fundamental unit of work in an operating system and in a realtime system.

A process is a program in execution: an instance of a program execution. Unit of work individually schedulable by an operating system (OS). A process includes:
  • program counter
  • stack
  • data section

OS keeps track of all the active processes and allocates system resources to them according to policies devised to meet design performance objectives. To meet process requirements OS must maintain many data structures efficiently. The process abstraction is a fundamental OS means for management of concurrent program execution. Example: instances of process co-existing.

Resources and Critical Sections

Tasks with shared resources may need mutual exclusion when they are accessing certain resources. Tasks may be cooperating to complete a job; Tasks may be contending to access a resource; Tasks may need synchronizing as to which task should go before a task2, etc. The resources that the task share are called critical resources and the regions of code that access these critical resources are called critical region. How do you protect a resource at home? using a lock? In an operating system, we use a primitive/resource called “semaphore” to implement mutual exclusion and synchronization. Lets look at the problem of "mutual exclusion" now. We will discuss syncronization later.

Critical Section and Semaphores

When multiples tasks are executing there may be sections where only one task could execute at a given time: critical region or critical section. There may be resources which can be accessed only be one of the processes: critical resource. Semaphores can be used to ensure mutual exclusion to critical sections and critical resources.

Priority Inversion

When we allow concurrent task to execute and with semaphore and mailboxes and other synchronization primitives, it is possible that a low priority task may come to block a high priority task. This situation is known as priority inversion. What happened on Mars?
More details on Pathfinder

Ideas for Term Project

Drones

  1. You can build a small drone and imeplement features like stabilization
  2. You can work on app to perform specific functions (e.g.collision avoidance) using the APIs and SDK provided by Parrot drone, Phanton 3
  3. You can review the current API and add to it
  4. You can also just work on an application using the existing features and auto pilot the drone to carry out operations. After all, thats what amazon drone does

Arduino

Here is a list of links for material available on Arduino. It has a very active community of developers.
  1. http://www.arduino.cc/
  2. M. McRoberts. Beginning Arduino. Apress, 2010.
  3. http://duino4projects.com/projects/car-projects/
  4. http://www.practicalarduino.com/projects/vehicle-telemetry-platform
  5. Many www.youtube.com Arduino tutorial videos
  6. http://en.wikipedia.org/wiki/Atmel_AVR
  7. https://code.google.com/p/opengauge/wiki/OBDuino
  8. http://ecomodder.com/forum/showthread.php/obduino-mega-10300.html
  9. http://playground.arduino.cc/Interfacing/Processing
  10. http://arduino.cc/en/Tutorial/HomePage

Raspberry PI

You can also use Raspberry PI or similar hardware.