Scheduling in real-time systems

A real-time system is one in which time plays a dominant role. Typically, one or more external physical devices present a stimulus to the computer, and the computer must respond appropriately within a defined time frame. For example, a computer in a CD player gets a bit stream from the drive and then has to convert the bit stream to music in very short time intervals. If the calculation time is too long, the music will sound abnormal. Other examples of real-time systems include patient monitoring units in intensive care units in hospitals, autonomous driving systems in airplanes, and robotic control in automated factories. In all these cases, a correct but late response is often worse than none.

Real-time systems can usually be divided into hard real time (hard real time) and soft real time (soft real time) . In both cases, real-time performance is achieved by dividing the program into a set of processes , where the behavior of each process is predictable and learned ahead of time. These processes are generally short-lived and run to completion extremely quickly. When an external signal is detected, the job of the scheduler is to schedule processes to meet all deadlines .

Events in a real-time system can be further classified as periodic (occurring at regular intervals) or aperiodic (occurring at an unpredictable time), depending on how they respond. A system may respond to multiple periodic streams of events. Depending on how long each event takes to process, the system might not even be able to process all events. For example, if there are m periodic events, event i occurs with period Pi, and requires Ci seconds of CPU time to process one event, then the condition that the load can be handled is

c1/p1+c2/p2+......+cm/pm≤1

A real-time system that satisfies this condition is said to be schedulable .

As an example, consider a soft real-time system with three periodic events whose periods are 100ms, 200ms, and 500ms. If these events require 50ms, 30ms, and 100ms of CPU time, respectively, then the system is schedulable because 0.5 + 0.15 + 0.2 < 1. If a fourth event is added with a period of 1 second, then the system is still schedulable as long as this event does not exceed 150ms of CPU time per event. Implicit in this calculation is an assumption that the overhead of context switching is small and negligible.

Scheduling algorithms for real-time systems can be static or dynamic . The former makes scheduling decisions before the system starts running ; the latter makes scheduling decisions during the running process. Static scheduling only works when all the information about the work being done and the deadlines that must be met is available in advance . The dynamic scheduling algorithm does not need these restrictions.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325877599&siteId=291194637