diff --git a/runtime/include/sandbox_functions.h b/runtime/include/sandbox_functions.h index 3803cc2..c4aee1a 100644 --- a/runtime/include/sandbox_functions.h +++ b/runtime/include/sandbox_functions.h @@ -105,12 +105,15 @@ sandbox_get_priority(void *element) return sandbox->absolute_deadline; }; -static inline int64_t +static inline uint64_t sandbox_get_srsf_priority(void *element) { struct sandbox *sandbox = (struct sandbox *)element; uint64_t now = __getcycles(); int64_t remaining_slack = sandbox->remaining_slack - (now - sandbox->last_update_timestamp); + if (remaining_slack < 0) { + return 0; + } return remaining_slack; }; diff --git a/runtime/src/global_request_scheduler_minheap.c b/runtime/src/global_request_scheduler_minheap.c index 94f45d8..f0c731b 100644 --- a/runtime/src/global_request_scheduler_minheap.c +++ b/runtime/src/global_request_scheduler_minheap.c @@ -71,12 +71,15 @@ sandbox_request_get_priority_fn(void *element) return sandbox_request->absolute_deadline; }; -int64_t +uint64_t sandbox_request_get_priority_srsf_fn(void *element) { struct sandbox_request *sandbox_request = (struct sandbox_request *)element; uint64_t now = __getcycles(); int64_t remaining_slack = sandbox_request->remaining_slack - (now - sandbox_request->last_update_timestamp); + if (remaining_slack < 0) { + return 0; + } return remaining_slack; };