实时处理期末总结

实时处理期末总结

1.Real-time system

  • A real-time system is a system with explicit time requirement
  • The system must be respond to external inputs within a specified period
  • Failure to meet the time requirements is as bad as producing the wrong outputs.
  • An example of real-time systems: MPEG video and audio encoder(30 frames/s)

2.scheduling algorithm

2.1 clock-driven scheduling approach

  1. scheduling decision are made at specific time instants,which are typically chosen a priori.
  2. Typically,hardware timer used to provided periodic time instans,at which the schduler wakes up and select the next jobs to execute.
  3. The approach is suitable for systems that consist of mostly deterministic and periodic tasks.

2.2 Weighted round-robin scheduling approach

  1. jobs are given weights and are placed in FIFO queue
  2. Processor’s time is divided into equal time slices.
  3. when it is job’s return,it will execute for Wi time before being pre-emptied for the next job in queue.
  4. New job execute almost immediately.This approachis suitable incremental producer/consumer jobs.

2.3 Priority-driven scheduling approach

  1. At any scheduling decision time,among the eligible jobs,the one with the highest priority is selected for execution.
  2. This approach tries to make locally optimal decision and is also known as greedy scheduling.
  3. Example are first-in-first-out,shortest-execution-time-first,earliest-deadine-first

3.Priority-Driven scheduling of periodic tasks

3.1Rate-Monotonic (RM)

  Highest priority = Task with the smallest period
  Utilisation = execution / period

Utotal =U1+U2+U3+…+Ui
if Utotal<= URM(i+1)
result: the task set is schedulable
else if URM(i+1) < Utotal <=1
br if meet the time-demanding
result: the task set is schedulable
else
result: the task set is not schedulable
else
result: the task set is not schedulable

3.2 Earliest-Deadline-First(EDF)

  Higest priority = Task with the earliest absolute deadline
  Utilisation = execution / period

Utotal =U1+U2+U3+…+Ui
if utotal<=1
result: the task set is schedulable
else
result: the task set is not schedulable

3.3 Deadline-Monotonic(DM)]

  Highest priority = Task with the smallest realtive deadline
  Utilisation = execution / period

Utotal =U1+U2+U3+…+Ui
if utotal<=1
result: the task set is schedulable
else
result: the task set is not schedulable

4.Priority-Driven Scheduling of Non-periodic Tasks

4.1 Scheduling aperiodic jobs

4.1.1 Background Execution

   * Aperiodic jobs are given the lowest priority
   * They are executed in the background,when no periodic or sporadic job is runing

4.1.2 Interrupt-driven Execution

   * Aperiodic jobs are given the highest priority
   * Each new aperiodic job causes an interrupt and preempts the currently executing

4.1.3 Polled Execution

     All aperiodic jobs are placed in a queue
     A periodic task is created to servide the aperiodic queue
     The periodic task is called a server
4.1.3.1 Polling Server
*  when executed,a polling server runs the job at the head of the aperiodic queue until:
    ** the queue is empty or
    ** poller budget is completely used
*  when  the aperiodic queue is empty
    ** the server suspends immediately
    ** the remaining budget is cleared to 0
    ** the budget is recharged to e only in the next Period p

polling server

4.1.3.2 Deferrable Server
*  if no aperiodic job is ready,the deferrable server preserves its budget and suspends itself
* when a new aperiodic job arrives and the deferrable server still has budget,the server is actived to run the aperiodic job immediately

R
deferrable server

4.1.3.3 Sporadic Server
 * A sporadic server is T(p,e) treated exactly as a periodic task with period p and execution e
 * Parameter P and e are chosen so that the sporadic server and existing periodic tasks are schedulable

4.2 Scheduling sporadic jobs

4.2.1 Sporadic jobs

  *  A sporadic job has a hard deadline and requires extra handing
  *   Each sporadic job is checked if it can complete on time without affecting the periodic jobs and existing sporadic jobs
  *  In dynamic-priority systems,sporadic jobs are scheduled with periodic jobs using the EDF rule
  *  In static-priority systems,sporadic jobs are serviced using a sporadic server

4.2.2 Accetance Test

     1.EDF
       1-d-(e/(d-r))>=s   is accepted
     2.static-priority
       if i==1
          floor(( Di-Ri)/Ps)*Es>=E1
       else
         floor(( Di-Ri)/Ps)*Es-C>=Ei

5. Multi-processor Scheduling

5.1 Task assignment

5.1.1 First fit(FF)

1. Total Utilisation of each processor must nor exceed a present limit U(U=1)
2. Assign tasks one-by one in an arbitrary order

5.1.2 Rate-monotonic first fit(RMFF)

  1. Tasks are allocated in the order of increasing periods.
  2. A new task T can be assigned to processor P if uT+Up<=URM (n+1).
  3. Let n be the number of tasks currently assigned to processor.
  4. Let Up be the current utilisation of processor P.

5.1.3 Rate-monotonic small tasks(RMST)

  1. Tasks set sorted in the increasing order of X
  2. For each Task Ti ,a parameter Xi is computed
  3. R=max(X)-min(X)
  4. UT+Up<=max(ln2,1-R*ln2)

5.1.4 Rate-monotonic general task

1. Divided the task set into two subsets: Subset "small":task with utilisation<=1/3  ,Subset "large" task: tasks with utilisation > 1/3.
2. Assign subsets "small" according to the RMST algorithm.
3. Assign subsets "large" according to the RMFF algorithm.

5.2 Inter-processor synchronisation

5.2.1 Greedy protocol

  1. A job is released as soon as its predecessor is completed
  2. Job Ji,k+1,n is released when job Ji,k,n is completed

5.2.2 Phase-modification protocol

  1. It enforce periodic release of every subtasks
  2. Job ji,k+1,n is released time: *Ji,k+1,n=SUMi=1k(Wi,l)+Qi+(n-1)pi

5.2.3 Modified phase-modification protocol

  1. Similar to PM protocol except that a job is not released unless its predecessor has been completed
  2. Job ji,k+1,n is released time: max(releasetime of Ji,k,n+Wi,k,completion time of Ji,k,n)

5.2.4 Release guard protocol

  1. Job ji,k+1,n is released time:
  2. if busy since Ji,k+1,n-1
    then
    max(ri,k+1,n-1+Pi,finish of Ji,k,n)
    else
    max(finish of Ji,k,n,processor become free)

5.3 Subtask scheduling

AlgorithmRelative Deadline
Utilmate DeadlineDi,k=Di
Effective DeadlineDi,k=Di -SUMq=k+1K(ei,q)
Proportional DeadlineDi,k=Di *(ei,k/ei
Normalised Proportional DeadlineDi,k=Di (ei,k(U(Vi,k)/(SUMq=1K(ei,q*U(Vi,q)))))

6 Resource and resource Access Control

6.1 Access control protocol

6.1.1 Non-preemptive critical section protocol(NCS)

 1.when a job requests a resource,it is always granted the resource
 2.when a job holds any resource ,it must not be interrupted
 3.A job is blocked at most once by a lower-priority job
 4.Maximum blocking time of job J<=max(critical sections of lower-priority jobs )

6.1.2 Priority-inheritance protocol

1.default priority:given by the scheduling algorithm such as RM or EDF
2.current priority: changed dynamically according to the access control protocol
3.Priority-inherited rules:
         When job J is blocked by job J'(that is ,J' is holding resource R that J requests);
         job J' inherits the current priority of J,and
         Job j' continues running at the inherited priority until it release  R.
         finally,Job J' returns to is priority at time t' when it acquired R

6.1.3 Priority-celling protocol

 1. Each resource R is givenn a priority celling P,which is the highest priority among the job's that need R.
 2. The system is given a priority ceiling P,which is the highest priority among the resource that are currently in use.
 3. Allocation rule:A request for a resource R by job J is granted only if the resource is free and
   J has a priority greater than priority of the system,or
   J holds a resource with priority equal  priority of system
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值