Skip to content

Commit

Permalink
Add global fair lateness scheduling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratfink committed Dec 12, 2022
1 parent b54d259 commit ae91aa3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/src/schedules.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ plot(s, size=(600, 300))
```@docs
schedule_global
schedule_gedf
schedule_gfl
schedule_gfp
AbstractSchedule
AbstractTaskSchedule
Expand Down
1 change: 1 addition & 0 deletions src/RealTimeScheduling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export AbstractRealTimeTask,
schedule_global,
schedule_gfp,
schedule_gedf,
schedule_gfl,
# Weakly-hard constraints
WeaklyHardConstraint,
MeetAny,
Expand Down
19 changes: 17 additions & 2 deletions src/schedules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ end
Simulate a preemptive global schedule of task system `T` on `m` processors to the specified
`endtime`. When releasing a job, the function `release!(job)` is called, allowing
arbitrary modifications to be made, enabling a wide variety of global schedulers to be
implemented. Two common examples are provided: [`schedule_gfp`](@ref) and
[`schedule_gedf`](@ref).
implemented. Three examples are provided: [`schedule_gfp`](@ref), [`schedule_gedf`](@ref),
and [`schedule_gfl`](@ref).
The `job` provided to `release!(job)` defaults to being released as early as possible (i.e.
at time 0 or one period after the task's last job), and has the relative deadline and cost
Expand Down Expand Up @@ -323,6 +323,21 @@ schedule_gedf(T::AbstractRealTimeTaskSystem, m::Int, time::Real) = schedule_glob
j.priority = deadline(j)
end

"""
schedule_gfl(T, m, time)
Simulate a preemptive global fair lateness (GFL) schedule of task system `T` on `m`
processors for the specified `time`. This provides the lowest tardiness bounds of any
GEDF-like scheduler under compliant vector analysis; for more information, see Erickson,
"Managing Tardiness Bounds and Overload in Soft Real-Time Systems."
DOI: [10.17615/fvp3-q039](https://doi.org/10.17615/fvp3-q039).
See also [`schedule_global`](@ref) for more general global scheduling.
"""
schedule_gfl(T::AbstractRealTimeTaskSystem, m::Int, time::Real) = schedule_global(T, m, time) do j
j.priority = deadline(j) - (m - 1) / m * cost(j)
end

@recipe function scheduleplot(sched::RealTimeTaskSchedule)
endtime = maximum(supremum.(Iterators.flatten(exec.(Iterators.flatten(sched.jobs)))))
layout --> (length(sched.tasks), 1)
Expand Down

0 comments on commit ae91aa3

Please sign in to comment.