cpe 746 embedded real embedded real time time cpe 746
play

CPE 746- -Embedded Real Embedded Real- -Time Time CPE 746 - PowerPoint PPT Presentation

CPE 746- -Embedded Real Embedded Real- -Time Time CPE 746 Systems- - Fall 06 Fall 06 Systems Types of RTS Types of RTS Done By : Mohammed Al Afifi Mohammed Ismail Supervised By : Dr. Lo : Dr. Lo ai Tawalbeh ai Tawalbeh


  1. CPE 746- -Embedded Real Embedded Real- -Time Time CPE 746 Systems- - Fall 06 Fall 06 Systems Types of RTS Types of RTS Done By : Mohammed Al Afifi Mohammed Ismail Supervised By : Dr. Lo : Dr. Lo’ ’ai Tawalbeh ai Tawalbeh Supervised By Computer Engineering Department Computer Engineering Department Jordan University of Science and Technology Jordan University of Science and Technology

  2. Introduction Introduction � The world has thousands of applications running The world has thousands of applications running � on millions of micro- - controllers that utilize simple controllers that utilize simple on millions of micro executives or “ “ bare metal bare metal” ” applications. These applications. These executives or applications typically are built around one of applications typically are built around one of three configurations. three configurations. � First, the super First, the super- - loop foreground/ background loop foreground/ background � processing system is the smallest and simplest processing system is the smallest and simplest design. design. � Second, the co Second, the co- - operative multi operative multi- - tasking system, tasking system, � requiring tricky synchronization planning. requiring tricky synchronization planning. � Third, the pre Third, the pre- - emptive multi emptive multi- - tasking system is tasking system is � the most complex. the most complex.

  3. Multi- -Tasking Tasking Multi � Multi Multi- - tasking refers to the ability of a tasking refers to the ability of a � system to execute more than one system to execute more than one task at the same time. task at the same time. Preem ption Preem ption � Preemption is defined as the act of a Preemption is defined as the act of a � higher- - priority process taking control priority process taking control higher of the processor from a lower- - priority priority of the processor from a lower task. task.

  4. Foreground/Background Foreground/Background Systems Systems � Small, simple systems usually don't have Small, simple systems usually don't have � an OS an OS � Instead, an application consists of an Instead, an application consists of an � infinite loop that calls modules (functions) infinite loop that calls modules (functions) to perform various actions in the to perform various actions in the “ Background Background ” ” . . “ � Interrupt Service Routines ( Interrupt Service Routines ( ISRs ISRs) handle ) handle � asynchronous events in the “ “ Foreground Foreground ” ” asynchronous events in the � Foreground = Foreground = interrupt level interrupt level � � Background = Background = task level task level �

  5. Foreground/Background Foreground/Background System System

  6. � Foreground Foreground - - relies on hardw are relies on hardw are � based scheduling based scheduling � Priority scheduling for interrupts Priority scheduling for interrupts � is often provided by m icro- - is often provided by m icro controllers. controllers. � Background: "m ain loop" Background: "m ain loop" �

  7. Non- -Preemptive Preemptive “ “Cooperative Cooperative” ” Non Multitasking Multitasking � Each task can control the CPU for as long as it Each task can control the CPU for as long as it � needs it. needs it. � The task currently controlling the CPU must offer The task currently controlling the CPU must offer � control to other tasks. control to other tasks. � Called cooperative because all tasks must Called cooperative because all tasks must � cooperate for it to work. If one task acts like a cooperate for it to work. If one task acts like a selfish and self- - centric person and does not centric person and does not selfish and self cooperate, it can hog the CPU. cooperate, it can hog the CPU. � Cooperative multitasking Cooperative multitasking has the advantage of has the advantage of � making the operating system design much making the operating system design much simpler, but it also makes it less stable because a simpler, but it also makes it less stable because a poorly designed application may not cooperate poorly designed application may not cooperate well, and this often causes system freezes system freezes well, and this often causes

  8. non- -preemptive Kernel preemptive Kernel non

  9. Preemptive Multitasking Preemptive Multitasking � The operating system allocates the The operating system allocates the � CPU time slices to each task. CPU time slices to each task. � Preemptive multitasking forces tasks Preemptive multitasking forces tasks � to share the CPU whether they want to share the CPU whether they want to or not. to or not.

  10. Pre- -emptive kernel emptive kernel Pre

  11. Scheduling Scheduling � It is the process of determining which task It is the process of determining which task � runs when in a multi- - tasking system is tasking system is runs when in a multi referred to as CPU scheduling or plain referred to as CPU scheduling or plain scheduling. scheduling. � Scheduling algorithm Scheduling algorithm : The algorithm : The algorithm � followed to decide who gets next turn on followed to decide who gets next turn on CPU. CPU. � The program that does this is called the The program that does this is called the � Scheduler . . Scheduler

  12. Scheduling Algorithms Scheduling Algorithms � Round Round- - Robin Scheduling Robin Scheduling �

  13. Priority Based Pre- -emptive emptive Priority Based Pre Scheduling Scheduling Most RTOSs RTOSs today control the execution of application softw are today control the execution of application softw are Most � � tasks by using priority based pre- - em ptive scheduling. em ptive scheduling. tasks by using priority based pre I n this approach, softw are developers assign a num eric “ “priority priority” ” I n this approach, softw are developers assign a num eric � � value to each task in their application softw are. value to each task in their application softw are. The RTOS The RTOS’ ’s s task scheduler w ill allow tasks to run, and w ill sw itch task scheduler w ill allow tasks to run, and w ill sw itch � � am ong the tasks. am ong the tasks. the highest priority task that is ready to run, should alw ays be the highest priority task that is ready to run, should alw ays be the the � � task that is actually running. task that is actually running. if a relatively low priority task is running and a higher priority task ty task if a relatively low priority task is running and a higher priori � � becom es ready – – the scheduler m ust im m ediately stop the low the scheduler m ust im m ediately stop the low becom es ready priority task ( even in m id- - execution) and allow the higher priority execution) and allow the higher priority priority task ( even in m id task to begin to run im m ediately task to begin to run im m ediately W hen the higher priority task is done, the low priority task is s W hen the higher priority task is done, the low priority task i � � allow ed to continue running – – from the point at w hich it w as from the point at w hich it w as allow ed to continue running stopped. stopped.

  14. � Priority Scheduling Priority Scheduling �

  15. � Fixed Fixed- - Priority Preem ptive Round Priority Preem ptive Round- - � Robin Scheduling Robin Scheduling

  16. Priority Based Pre- -emptive Scheduling emptive Scheduling Priority Based Pre Drawbacks Drawbacks � low priority tasks may suffer low priority tasks may suffer “ “ starvation starvation” ” . . � � there is no way to tell a priority there is no way to tell a priority- - based based � preemptive scheduler about software deadlines. preemptive scheduler about software deadlines.

  17. Alternatives to priority- -based based Alternatives to priority pre- -emptive scheduling emptive scheduling pre � Deadline Scheduling: Deadline Scheduling: � � � In this approach, the RTOS kernel's task In this approach, the RTOS kernel's task scheduler is provided with information about scheduler is provided with information about task deadlines. task deadlines. � � temporarily raises the priorities of tasks as temporarily raises the priorities of tasks as they approach their deadlines if they have not they approach their deadlines if they have not yet run yet run � In this way, the deadline scheduler gets the � In this way, the deadline scheduler gets the tasks to run before they miss their deadlines, tasks to run before they miss their deadlines, by preemptively “ “ borrowing borrowing” ” running time running time by preemptively from tasks that normally have higher priorities. from tasks that normally have higher priorities.

  18. � There are a number of ways for an There are a number of ways for an � RTOS to do deadline scheduling: RTOS to do deadline scheduling: • EDF EDF – – earliest deadline first scheduling: earliest deadline first scheduling: • • LL LL – – least laxity scheduling least laxity scheduling • • MUF MUF – – maximum urgency first scheduling. maximum urgency first scheduling. •

Recommend


More recommend