Académique Documents
Professionnel Documents
Culture Documents
Chapter 3
To validate the real time systems and the timing constraints , we describe a reference model of real time systems In this model, the real time systems is characterized by three elements: (1) A workload model (2) A resource model (3) Algorithms that define how the application use these resources In this chapter, the focus will be on the first two models Model 3 will be discussed in a later chapters
The resource model describes the system resources available to the applications The workload model describes the applications supported by the systems
The system resources is divided into two major types: 1. Processors 2. Resources
Processors Processors are often called servers e.g. computers, transmission link, disks, etc. We use p to denote processors p1, p2, , pm
Job: is a unit of work to be allocated processor time and other resources Task: is a set of related jobs To ensure that the system meets its hard real time requirement, many parameters of hard real time jobs are known a head of time E.g. of parameters: the number of tasks , the deadline of the task,
The number of jobs in the system may change E.g. air traffic control system - each surveillance task monitors an aircraft - the number of tasks changes as tasks are added and deleted when aircraft enters and leave the coverage area the number of tasks with hard real timing constraints is known all the time Otherwise, it would not be possible to ensure that the system meet its hard real time requirements
The number of tasks with hard real timing constraints is known all the time When the satisfaction of their timing constraints is to be guaranteed, the admission and the deletion of the hard real time jobs are done by the scheduler The system must maintain information on all existing hard real timing constraints
Each job ji is characterized by its temporal parameters, functional parameters, and resource parameters, and interconnection parameters The temporal parameter of the jobs Tells us its timing constraints and behavior The interconnection parameter of the jobs Describe how it depends on other jobs and how other jobs depend on it The Functional parameters Specify the intrinsic properties of the job
If we can approximate the actual release time of each job by its earliest or latest release time, then we say that the job has a fixed release time Every real time system is required to respond to external events which occur at random instant of time When such event occurs, the system executes the set of jobs in response The release time of these jobs are not known until the event triggering them occurs These jobs are called sporadic jobs or aperiodic jobs because they are released at random time instants
E.g. the pilot may disengage the auto pilot system at any time When this occurs, the autopilot systems change from cruise mode to stand by mode The jobs that execute to accomplish this mode change are called sporadic jobs The release times of sporadic and aperiodic jobs are random variables
The model of the system gives the probability distribution A(x) of the release time of such a job, or when there is a stream of similar sporadic or aperiodic jobs A(x) gives us the probability that the release time of the job is at or earlier than x We use the term arrival rate or interarrival rate instead of using the release time of aperiodic A(x) is the arrival time distribution
Execution Time
Another temporal parameter of a job Ji is its execution time ei ei is the amount of time required to complete the execution of ji when it executes and has all the resources it requires The value of this parameter depends mainly on the complexity of the job and the speed of the processor used to execute the job, not on how the job is scheduled
Execution Time
The actual amount of time required by a job to complete its execution may vary for many reasons A computation may contain conditional branch The branches may take different amount of time to complete The branches takes during the execution of the computation job depend on the input data Cache memory, pipeline For these reasons, the actual execution time of a computation job is unknown until it completes
Execution Time
What can be determined a priori is minimum execution time and the maximum execution time [ei-, ei+] ei-: the minimum amount of time required to complete a job ei+: the maximum amount of time required to complete a job We assume that we know ei- and ei+ for every hard real time job Ji The actual execution time of the job is unknown
Execution Time
For the purpose of determining whether each job can always complete by its deadline Knowing the maximum execution time of job is sufficient In most real time systems models that used to characterize hard real time systems, ei of each job Ji specifically means the maximum execution time Except where state otherwise, we never mean that the actual execution time of the job is fixed and known, only that it never exceeds ei
Execution Time
The processors might be underutilized The hard real time portion is often small The timing requirements of the rest of the system are soft It is the best option to design the hard real time subsystem based on its worst case processor time and the resource requirement even though their actual requirements maybe much smaller This method will be used to ensure that the hard timing constraints will surely be met all the time
The execution time of the periodic task is the maximum execution time of all the jobs in it We use ei to denote the execution time of the periodic task The periodic task refers to a task that is truly periodic, the interrelease time of all jobs in the periodic task are equal to its period More details in periodic task will be explained in chapter 6
Real time system is required to respond to external events To respond, it executes aperiodic or sporadic jobs whose release times are not known a priori Example: an operators adjustment of the sensitivity setting of the radar surveillance system The radar system must continue to operate, but in addition it also must respond to the operators command When a pilot changes the auto pilot from cruise mode to standby mode, the system must respond by configuring itself , while continuing to execute the control tasks that fly the airplane
The autopilot system is required to respond to a pilots command to disengage the autopilot and take over the control manually within a specific time Tasks containing jobs that are released at random time instants and have hard deadlines are sporadic tasks
Data and control dependencies among jobs may constrain the order in which they can execute In classical scheduling theory, the jobs are said to have precedence constraints if they are constrained to execute in some order Otherwise, if the jobs can execute in any order, they are said to be independent For example, in radar surveillance system, the signal processing task is the producer of track records, while the tracker task is the consumer
Each tracker job processes the track records generated by a signal processing job The designer may choose to synchronize the tasks so that the execution of the kth tracker job does not begin until the kth signal processing job complete The tracker job is precedence constrained In general, a consumer job has this constraint whenever it must synchronize with the corresponding producer jobs and wait until the producer completes in order to execute
Example Consider queries to an information server Suppose that before each query is processed and the requested information retrieved, its authorization to access the requested information is first checked The retrieval job can not begin execution until the authorization job completes The communication job that forwards the information to the requester can not begin until the retrieval job completes
In communication system, the jobs that generate an acknowledgement of a message and transmit the acknowledgement of a message can not begin until the job receives and processes the message complete
A task graph gives us a general way to describe the application system is an extended precedence graph
Functional Parameter
Preemptivity of jobs execution of jobs can often be interleaved The scheduler may suspend the execution of a less urgent job and give the processor to a more urgent job When the more urgent job completes, the scheduler returns the processor to the less urgent job so the job can resume execution This interruption of jobs called preemption
Functional Parameter
A job is preemptable if its execution can be suspended at any time to allow the execution of other jobs, and later on, can be resumed from the point of suspension A job is nonpreemptable if it must be executed from start to completion without interruption This constraint me be imposed because its execution , if suspended and the processor given to other jobs, must be executed again from the beginning Example Jobs that model the transmission of data frame in a token ring, if transmission of frame is interrupted before it completes, the partially transmitted frame is discarded by the receiver
Functional Parameter
During the preemption, the system must first save the state of the preempted jobs at the time of preemption so it can resume the job from that state For example, in the case of CPU jobs, the state of the preempted job include the content of its program counter, processor status register, and register containing temporary results After saving the contents of these registers in memory and before the preempting job can start, the operating system must load the new processor status register, clear the pipeline, and so on These actions are called context switch (overhead work done during preemption)
Functional Parameter
Criticality of Jobs jobs are not equally important The importance ( criticality) of jobs is a positive number that indicates how critical the job is with respect to other jobs The more critical the job, the larger its importance The term priority and weight are often used to refer to importance The more important a job, the higher its priority or the larger its weight
Functional Parameter
During the overload when it is possible to schedule all the jobs to meet their deadline Sacrifice the less critical jobs so that the more critical jobs can meet their deadline For example, in a flight control and management system, the job that controls the flight of the aircraft is more critical than the navigation job The navigation job is more critical than the job that adjust the course and cruise speed in order to minimize fuel consumption The cabin air flow and the temperature control job is more critical than jobs that run movies
Functional Parameter
The laxity type of a job indicates whether its timing constraints are soft or hard
CPU Scheduler
Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them. CPU scheduling decisions may take place when a process: 1. Switches from running to waiting state 2. Switches from running to ready state 3. Switches from waiting to ready 4. Terminates
Scheduling Criteria
CPU utilization keep the CPU as busy as possible Throughput # of processes that complete their execution per time unit Turnaround time (TAT) amount of time to execute a particular process Waiting time amount of time a process has been waiting in the ready queue Response time amount of time it takes from when a request was submitted until the first response is produced
Example:
P1
0
P2
P3
P2 P3 P1 Non-preemptive scheduling 0 3 6 30 Troublesome for time-sharing systems Convoy effect short process behind long process
Example:
P3 7 8
P2 12
50
Example:
P1
P1(7) 0 2 P1(5)
P2 P3
4 5
P2 7
P4
11
51
P1 P2 P3 P4 P1 P3 P4 P1 P3 P3 0 20 37 57 77 97 117 121 134 154 162 P1(13) P1(33) 24 P1(53) 57 P2(17) 20 P3(68) P4(24)
37 57 Average wait time = (81+20+94+97)/4 = 73 40P3(48) 40
17
P3(28) P3(8)
P4(4)
CSS430 CPU Scheduling 52
Typically, higher average turnaround than SJF, but better response. Performance q large FCFS q small q must be large with respect to context switch, otherwise overhead is too high.
53