Girish Mahajan (Editor)

Stack Resource Policy

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

The Stack Resource Policy (SRP) is not the same as the Priority ceiling protocol which is for fixed priority tasks (FP). SRP was defined by T. P. Baker and is used for accessing shared resources when using Earliest deadline first scheduling.

Contents

Function

Each task is assigned a preemption level based upon the following formula where D ( T i ) denotes the deadline of task i and π i ( T i ) denotes the preemption level of task i:

D ( T i ) < D ( T j ) π i ( T i ) > π i ( T j )

Each resource R has a current ceiling C R ( V R ) that represents the maximum of the preemption levels of the tasks that may be blocked, when there are V units of R available and μ R ( J ) is the maximum units of R that T i may require at any one time. C R ( V R ) is assigned as follows:

C R ( V R ) = m a x ( { 0 } { π ( J ) | V R < μ R ( J ) } )

There is also a system ceiling π which is the maximum of all current ceilings of the resources.

π = m a x ( { C R ( i ) | i = 1 , . . . , m } { π ( J c ) } )

Any task T i that wishes to preempt the system must first satisfy the following constraint:

π < P i ( T i )

This can be refined for Operating System implementation (as in MarteOS) by removing the multi-unit resources and defining the stack resource policy as follows

  • All tasks are assigned a preemption level, in order to preserve the ordering of tasks in relation to each other when locking resources. The lowest relative deadline tasks are assigned the highest preemption level.
  • Each shared resource has an associated ceiling level, which is the maximum preemption level of all the tasks that access this protected object.
  • The system ceiling, at any instant in time, is the maximum active priority of all the tasks that are currently executing within the system.
  • A task is only allowed to preempt the system when its absolute deadline is less than the currently executing task and its preemption level is higher than the current system ceiling.
  • Relevancy

    The 2011 book Hard Real-Time Computing Systems: Predictable Scheduling Algorithms and Applications by Giorgio C. Buttazzo featured a dedicated section to reviewing SRP from Baker 1991 work.

    References

    Stack Resource Policy Wikipedia