
Real-Time Systems Task Scheduling in Embedded Systems
Learn about task scheduling in real-time systems within the field of embedded systems, including the significance of deadlines, task priorities, preemption, and system integrity maintenance. Explore examples and case studies to understand the practical implications of these concepts.
Download Presentation

Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.
E N D
Presentation Transcript
Subject Name : Embedded Systems Department of : ECE Created By: Dr. Ravinder Nath Rajotiya JIMS Engineering Management Technical Campus Greater Noida, UP -201308 (Affiliated to Guru Gobind Singh Indraprastha University, New Delhi)
Subject : Embedded Systems Topic: : Real time Systems Task Scheduling
Outline Deadlines Priority Task Scheduling
Deadlines In our dishwasher, water manager fill the water, once the tank is full, the task of water manager is to immediately shut the water intake otherwise So is other tasks. Every task in a real time system is characterized by a deadline a task is expected to perform its function by the time allocated to it i.e. before the deadline. The time allocated may be : Absolute ( if a task must complete its function within the given time then it is absolute deadline) Relaxed : If the system should perform its task within about or around a given time the deadline is called as relaxed deadline Real time System: Hard Real Time: If deadline are absolute the it is Hard RTS: Tasks are governed by Rigid time constraint Soft Real Time: If deadline are relaxed then the RTS is Soft RTS, and tasks do not have rigid time constraint Ques: What type of task is water management task ? What about Display Manager Task ? What happen if the task manager fails to meet the deadlines? It is imperative to determine the task deadlines and their consequences in a system. This leads to a concept of priority
Priority Priority determines the importance of a task in a system. In a real time system every task is assigned a priority.. Priority determines the relative order of the importance of the task in a system: Important tasks have high priority Less important tasks have high priority Higher the priority, better are the chance of executing the task on the microcontroller and meeting its deadlines. What can you say the level of priority in our dish washer cases? Water management and display management But how does priority system help manage coherent functioning of a system. This is by Preemption
Preemption Using priority of each task in a system, we can device a scheme by preempting a low priority task from preventing the high priority task. This is by preempting the low priority task to maintain the coherency of work. Prerogative of higher priority task in a system Allow higher priority task to pause a lower priority task Necessary to maintain system integrity of a real-time system
Example Figure-1 above shows the tasks and figure 2 just below that shows the time line of tasks. T1- Water ON, display update starts T2: water full, display update cont T3: Water Shutts off, disp update paused T4: Disp update completed and the whole message displayed
Types of Real-Time Tasks We have already seen that a real-time task is one for which quantitative expressions of time are needed to describe its behavior. This quantitative expression of time usually appears in the form of a constraint on the time at which the task produces results. The most frequently occurring timing constraint is a deadline constraint which is used to express that a task is required to compute its results within some deadline. We therefore implicitly assume only deadline type of timing constraints on tasks in this section, though other types of constraints (as explained in Sec. .) may occur in practice. Real-time tasks can be classified into the following three broad categories hard, soft, or firm real-time task depending on the consequences of a task missing its deadline. PTO
Type of RTS cont Real-time systems are systems that carry real-time tasks. These tasks need to be performed immediately with a certain degree of urgency. In particular, these tasks are related to control of certain events (or) reacting to them. Real-time tasks can be classified as :Hard, Firm and Soft real-time tasks. A hard real-time task :A hard real-time task is one that is constrained to produce its results within certain predefined time bounds. The system is considered to have failed whenever any of its hard real-time tasks does not produce its required results before the specified time bound. An example of a system having hard real-time tasks is a robot. The robot cyclically carries out a number of activities including communication with the host system, logging all completed activities, sensing the environment to detect any obstacles present, tracking the objects of interest, path planning, effecting next move, etc. Now consider that the robot suddenly encounters an obstacle. The robot must detect it and as soon as possible try to escape colliding with it. Firm Real-Time Tasks Every firm real-time task is associated with some predefined deadline before which it is required to produce its results. However, unlike a hard real-time task, even when a firm real-time task does not complete within its deadline, the system does not fail. The late results are merely discarded. In other words, the utility of the results computed by a firm real-time task becomes zero after the deadline. In soft real-time tasks: Soft real-time tasks also have time bounds associated with them. However, unlike hard and firm real-time tasks, the timing constraints on soft real-time tasks are not expressed as absolute values. Instead, the constraints are expressed either in terms of the average response times required. An example of a soft real-time task is web browsing. Normally, after an URL (Uniform Resource Locater) is clicked, the corresponding web page is fetched and displayed within a couple of seconds on the average. However, when it takes several minutes to display a requested page, we still do not consider the system to have failed, but merely express that the performance of the system has degraded.
Scheduler Which authority in the system decide which task should run when. This is the job of a scheduler. At any given time it decides which task must be performed and which task must be paused. In the dish washer example when the task of fill water is going on the low priority task is paused or put in update cycle. Only after water manager finishes its task that the scheduler allows the low priority task of display is allowed. Maintains rank list of all tasks based on priority Enforces ranked list of tasks by allowing or disallowing tasks to perform their job Real time systems have priority based preemptive scheduling scheme.
Scheduler In real-time systems, the scheduler is considered as the most important component which is typically a short-term task scheduler. The main focus of this scheduler is to reduce the response time associated with each of the associated processes instead of handling the deadline. If a preemptive scheduler is used, the real-time task needs to wait until its corresponding tasks time slice completes. In the case of a non-preemptive scheduler, even if the highest priority is allocated to the task, it needs to wait until the completion of the current task. This task can be slow (or) of the lower priority and can lead to a longer wait. A better approach is designed by combining both preemptive and non-preemptive scheduling. This can be done by introducing time-based interrupts in priority based systems which means the currently running process is interrupted on a time-based interval and if a higher priority process is present in a ready queue, it is executed by preempting the current process
Types of Schedulers Based on schedulability, implementation (static or dynamic), and the result (self or dependent) of analysis, the scheduling algorithm are classified as follows. Static table-driven approaches: These algorithms usually perform a static analysis associated with scheduling and capture the schedules that are advantageous. This helps in providing a schedule that can point out a task with which the execution must be started at run time. Static priority-driven preemptive approaches: Similar to the first approach, these type of algorithms also uses static analysis of scheduling. The difference is that instead of selecting a particular schedule, it provides a useful way of assigning priorities among various tasks in preemptive scheduling. Dynamic planning-based approaches: Here, the feasible schedules are identified dynamically (at run time). It carries a certain fixed time interval and a process is executed if and only if satisfies the time constraint. Dynamic best effort approaches: These types of approaches consider deadlines instead of feasible schedules. Therefore the task is aborted if its deadline is reached. This approach is used widely is most of the real-time systems.