Lec20RTOS - Foreground/background systems Small systems are...

Info icon This preview shows pages 1–8. Sign up to view the full content.

ECE 471 20-RTOS-1 Lecture 20 Real-time Operating Systems Outline Foreground/background systems Task states Scheduler Semaphores/messages OS Calls Porting a RTOS
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

ECE 471 20-RTOS-2 Foreground/background systems Small systems are very often designed as foreground/background processing schemes. Foreground is the interrupt level. Background is the task level. Multitasking is similar to foreground/background with multiple backgrounds. Multitasking allows the application programmer to manage complexity inherent in real-time applications. An RTOS kernel can simplify the design of systems, but will require more system resources.
Image of page 2
ECE 471 20-RTOS-3 Task States A task is called a thread, a simple program that thinks it has the CPU all to itself. Tasks can be in any of four states: DORMANT: Not available to the kernel. READY: Can execute but priority is less than a task currently running. RUNNING: Has control of the CPU. WAITING: Requires the occurrence of an event to continue execution.
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

ECE 471 20-RTOS-4 Scheduler Scheduler determines which task will run next. Each task has an assigned priority based on its importance. Control of the CPU is always given to the highest priority task that is ready to run. Two types of kernels: Non-preemptive: A non-preemptive kernel requires that a task explicitly give up control of the CPU. Preemptive: The highest priority task ready to run is always given control of the CPU.
Image of page 4
ECE 471 20-RTOS-5 Clock Tick A clock tick is an interrupt that occurs periodically allowing the kernel to obtain control of the CPU. Tasks can be suspended for an integer number of clock ticks. Depending on other interrupt service routines (ISR) that may be executing on the processor, the time between clock ticks may vary. The clock tick interval should be chosen wisely. Too short an interval will add excess overhead to the system, while too long of an interval provides inadequate resolution.
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

ECE 471 20-RTOS-6 Task priority A priority is assigned to each task. Tasks that need quicker response times are assigned higher priorities. A task priority that is assigned at compile time and cannot change during execution is considered static. Dynamic priorities can change during execution time.
Image of page 6
ECE 471 20-RTOS-7 Priority inversion A priority inversion occurs when a task (say task 1) is waiting for a resource (e.g., an output device) controlled by another task (say task 2). In addition task 1 has a higher priority than task 2, so it preempts task 2. Therefore, task 1 than waits for the resource, owned by lower priority level task 2, but does not let task to run. Since task 2 cannot run, it will not relinquish the CPU and thus the system is locked.
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 8
This is the end of the preview. Sign up to access the rest of the document.
  • Spring '08
  • Chien

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern