From ae91aa38faf927fb40c14966feba9d887d81c9ef Mon Sep 17 00:00:00 2001 From: Clara Hobbs Date: Mon, 12 Dec 2022 09:45:48 -0500 Subject: [PATCH] Add global fair lateness scheduling --- docs/src/schedules.md | 1 + src/RealTimeScheduling.jl | 1 + src/schedules.jl | 19 +++++++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/src/schedules.md b/docs/src/schedules.md index c784650..b4416e6 100644 --- a/docs/src/schedules.md +++ b/docs/src/schedules.md @@ -16,6 +16,7 @@ plot(s, size=(600, 300)) ```@docs schedule_global schedule_gedf +schedule_gfl schedule_gfp AbstractSchedule AbstractTaskSchedule diff --git a/src/RealTimeScheduling.jl b/src/RealTimeScheduling.jl index 984b228..c72328b 100644 --- a/src/RealTimeScheduling.jl +++ b/src/RealTimeScheduling.jl @@ -44,6 +44,7 @@ export AbstractRealTimeTask, schedule_global, schedule_gfp, schedule_gedf, + schedule_gfl, # Weakly-hard constraints WeaklyHardConstraint, MeetAny, diff --git a/src/schedules.jl b/src/schedules.jl index 9897d5c..f59b8b8 100644 --- a/src/schedules.jl +++ b/src/schedules.jl @@ -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 @@ -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)