0% found this document useful (0 votes)
17 views

Assignment-4es & iot

Iot

Uploaded by

sri296315
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
17 views

Assignment-4es & iot

Iot

Uploaded by

sri296315
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 8
a priority Based Scheduling Policies [Ei Exrliest-Deadline-First Scheduling « Earliest Deadline First (EDF) is one of the best known algorithms processing. It is an optimal dynamic algorithm. In dynamic priority algorith for real time priority of a task can change during its execution It produces a valid whenever one exists. & Schecuu Embedded Systems and loT 4-56 Embedded ¢ p, rogram, ng EDF is a preemptive scheduling algorithm that dispatches the process with earliest deadline, If an arriving process has an earlier deadline than the 44 + i ni process, the system preempts the running process and dispatches the artivy® process. B A task with a shorter deadline has a higher priority. It executes a job w, ith th earliest deadline. Tasks cannot be scheduled by rate monotonic algorithm, . EDF is optimal among all scheduling algorithms not keeping the processor idje at certain times. Upper bound of process utilization is 100 %. Whenever a new task arrive, sort the ready queue so that the task closest to the end of its period assigned the highest priority. System preempt the running task, it is not placed in the first of the queue in the last sorting. If two tasks have the same absolute deadlines, chose one of the two at random (ties can be broken arbitrarily). The priority is dynamic since it changes for different jobs of the same task. EDF can also be applied to aperiodic task sets. Its optimality guarantees that the maximal lateness is minimized when EDF is applied. Many teal time systems do not provide hardware preemption, so other algorithm must be employed. In scheduling theory, a real-time system comprises a set of real-time tasks; each task consists of an infinite or finite stream of jobs. The task set can be scheduled by a number of policies including fixed priority or dynamic priority algorithms. The success of a real-time system depends on whether all the jobs of all the tasks can be guaranteed to complete their executions before their deadlines. If they can, then we say the task set is schedulable. The schedulability condition is that the total utilization of the task set must be less than or equal to 1. Implementation of earliest deadline first : Is it really not feasible to implement EDF scheduling ? Arrival Duration Deadline | i uy 0 ; 10 : 33 | | tn 4 Micha 28 : o 10 | TECHNICAL PUBLICATIONS® . an up-thrust for knowledge 4-87 sons oT Embedded C Programming i Task arrivals __-~ Earlier deadiine (preemption) Later deadline (No preemption) Fig. 4.7.4 Problems for implementations : 1, Absolute deadlines change for each new task instance, therefore the priority needs to be updated every time the task moves back to the ready queue. 2, More important, absolute deadlines are always increasing, how can we associate a finite priority value to an ever increasing deadline value. 3. Most important, absolute deadlines are impossible to compute a-priori. EDF properties + 1. EDE is optimal with respect to feasibility (ie. schedulability). 2. EDF is optimal with respect to minimizing the maximum lateness. Advantages 1, It is optimal algorithm. 2. Periodic, aperiodic and sporadic tasks are scheduled using EDF algorithm. . Periodic, ap’ 3. Gives best CPU utilization. Embedd eg embedded Systems and lor CA Disadvantages 1. Needs priority 4 2, Needs dynamic priorities 3. Typically no OS support 4, Behaves badly under overload 5. Difficult to implement. ueue for storing deadlines Task Test if the given task set is schedulable with EDF. Solution : c CPU Utilization (U) = Eee 7 Rate Monotonic Scheduling * Rate Monotonic Priority Assignment (RM) is a so called static priority round robin scheduling algorithm, * In this algorithm, priority is increases with scheduled. The process of lowest period will * The priorities are assigned to tasks before exe, scheduling is preemptive, i,,a task can bepi In RM algorithms, the the rate at which a process must be get the highest priority. cution and do not change over time. RM veempted by a task with higher priority. assigned priority is never ified durin, i tiorities simply in sce wi te ee te Priority is as higher as shorter is the P See with its periods, ie. the activation rate. So RM is a scheduling algo nor which means as higher is the If a lower Priority zu ‘Or periodic task sets. P available to tun, it wy B and a hi a assigned 2 a Will preempt the lower priogi her priority process becom a Priority inversely based on its peri ity Process. Each Periodic task is Petlod, the higher the oe ony 5 Period, the lower the Priority, rocess is yy syste, and loT ee Embedded C Programming pe algorithm was proven under the followi . ; asks are periodic. wing assumptions : pba task must be completed before the next 5, all tasks are independent. request occurs. 4, Run Hime of each task request is constant. 5. ANY non-periodic task in the system ” has no requi i i - quired deadline: 1 RMS is optimal among all fixed priori S. . 01 ; pevodic tasks where the deadlines Priority schduling algorithms for scheduling of the tasks equal their = iS monitoring example periods. pat Utilization. U = 83.66 % GE—_+—__+—__+ t Tp 1 t t jf es ua Missed deadine Tz Seine oe ek Saag Fig. 4.7.2 (b) Tiara Brim GATIONS® - an upetrust for knowiede 4.60 Enotes - mM aidou ystems and IT ne Embectied Systeme wnt! ~~ ‘ne 2. Kasy to implement, A Stable algorittny, 1, Simple to understand. 2 Disadvantages : 1, Lower CPU utilization. 2. Only deal with independent ta 3. Non-precise schedulability analysis Comparison botwoon RMS and EDF 5 Sea = — I Parameters RMS rDE [ Se Static Dynamic | i i iooriti Yes | | Works with OS with fixed priorities Ne. | PAIS we | No Ye | j i 2 and T3, AU timing isin mill seconds, Execution Relative Periag time deadline Calculate the length of time by using table driven scheduler, Solution : The tasks in the schedule wi i ft The male oe of a an, will automatically Tepeat after every ft . major cycle. arbitrary pacing, ‘asks is LOM of the periods even when the tasks have Major cycle = Loy (20, 50, g0) = 400 ms ERAT Priority Inversion * Priority inversio : N occurs . ; igherpriority jt Waits, coe low-priority Job executes while some rea! ° Fig. 4.73 oh i INVersion method. is: TECHNIC, stot and [oT 4:61 kL d wt Embedded c f a Blocked Programming Normal execution Critical c T2 section "i es BB ty ot ; y tg Ti Fig. 4.7.3 Priority inversion method ™ 4 tasks Tl, T2 and i consider three T2 and T3 with decreasing prioriti . 8 Priorities. ghare some data or resource that requires exclusive acces , ce eae sract with either of the other two tasks, serra aT oes an Priority inversion Jy Ce ee es Geecrms eras | roreneees Lip ce pce) orm licen ees cere 0 2 4 6 8 10 12 14 16 18 Fig. 4.7.4 Priority inversion example Task T3 starts at time ty and locks semaphore s at time t,. At time t, Tl arrives and preempts T3 inside its critical section. After a while, T1 requests to use the shared resource by attempting to lock s, but it gets plocked, as T3 is currently using it. Hence, at time t3 continues to execute inside its critical section. Next, when T2 arrives at time ty, it preempts T3, as it has a higher priority and does not interact with either T1 or T3. The execution time of T2 increases the Dlocking time of Tl, as it is no longer dependent solely on the length of the critical section executed by T3. When tasks share resources, there may be priority inversions. Priority inversion is not avoidable; However, in some cases, could be too large. the priority inversion Simple solutions : 1. Make critical sections non-preemptable. ic that could use it 2. Execute critical sections at the highest priority of i oe wiority task blocks an The solution of the problem is rather simple; wn a saeity task; in this way, higher priority task, it inherits the priority of ney i P every medium priority annot make preempHon: me + for knowledge Embedded Systems and loT 4-62 Embedded ¢ Prog Timing anomalles ining /anomali * As seen, contention for resources can cause timing anomalies due to pp. inversion and deadlock, Unless controlled, these anomalies can be Li duration, and can seriously disrupt system timing. i Tt cannot eliminate these anomalies, but several protocols exist to contro] them ; Priority inheritance protocol Basic priority ceiling protocol Stack-based priority ceiling protocol 1. 2 3. Wait for graph Wait-for graph is used for representing dynamic-blocking relationship among jops, In the waitfor graph of a system, every job that requires some resource i, represented by a vertex labeled by the name of the job. At any time, the wait-for graph contains an (ownership) edge with label x from a resource vertex to a job vertex if x units of the resource are allocated to the job at the time. u ~ = . Wait-for-graph is used to model resource contention. Every serial reusable resource is modeled. Every job which requires a resource is modeled by vertex with arrow pointing towards the resource. | it Every job holding a resource is represented by a vertex pointing away from the = resource and towards the job. A cyclic path in a wait-for-graph indicates deadlock oy Fig. 4.7.5 shows wait for graph, ~C Fig. 4.7.5 Wait for graph Ja has locked the single unit of resource R and Ja is waiting to lock it, * Arminimum of two system resources are Tequired in a deadlock ——

You might also like