From bdcfc94b573e09512ca6021fe8964e875b7fdd6c Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sun, 25 Jun 2023 01:02:12 +0200 Subject: [PATCH] Scheduler: implementation technology - use Boost-Lockfree as entrance queue for instructions - use the STL Heap-Algo and Priority-Queue adaptor for time order --- src/vault/gear/scheduler-invocation.hpp | 15 ++- wiki/thinkPad.ichthyo.mm | 117 ++++++++++++++++++++++++ 2 files changed, 131 insertions(+), 1 deletion(-) diff --git a/src/vault/gear/scheduler-invocation.hpp b/src/vault/gear/scheduler-invocation.hpp index 2893b2050..fb8b61d2b 100644 --- a/src/vault/gear/scheduler-invocation.hpp +++ b/src/vault/gear/scheduler-invocation.hpp @@ -41,10 +41,12 @@ #include "vault/common.hpp" #include "lib/nocopy.hpp" //#include "lib/symbol.hpp" +#include "vault/gear/activity.hpp" //#include "lib/util.hpp" //#include - +#include +#include namespace vault{ namespace gear { @@ -62,6 +64,17 @@ namespace gear { class SchedulerInvocation : util::NonCopyable { + struct ActOrder + { + size_t waterlevel{0}; + Activity* activity{nullptr}; + }; + + using InstructQueue = boost::lockfree::queue; + using PriorityQueue = std::priority_queue; + + InstructQueue instruct_; + PriorityQueue priority_; public: explicit diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 10bc78cb1..305f43883 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -77935,6 +77935,35 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -78544,6 +78573,37 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + +

+ Earliest deadline first (EDF) or least time to go is a dynamic priority scheduling algorithm used in real-time operating systems to place processes in a priority queue. Whenever a scheduling event occurs (task finishes, new task released, etc.) the queue will be searched for the process closest to its deadline. This process is the next to be scheduled for execution. +

+ +
+
+ + + + + + + + + +

+ ...und würde dann strikt nach zeit-Ordnung zuerst bedient, und damit dem Realtime-Task die Ressourcen wegnehmen +

+ +
+ +
+
+
@@ -83257,6 +83317,63 @@ class Something + + + + + + + + + + + + + + +

+ Eine Störstelle in der Heap-Struktur wird durch „lokales bouble“ korrigiert. Ein am Ende hinzugefügtes Element boubled hoch, bis es größer ist als beide Kinder. Für ein entferntes größtes Element rutscht das größere Kind hoch. Für ein entferntes inneres Element wird zunächst das letzte Element an diese Stelle gesetzt  (weil dadurch dann die letzte Position frei wird); die dadurch entstehende Störstelle wird dann nach oben/unten korrigiert: ist das Element größer als der Vater, tauscht es mit diesem, ist es kleiner als das größere seiner Kinder, tauscht es mit diesem. +

+ +
+
+ + + + + + + + + + + +

+ ...hatte ich vor einigen Jahren schon durchgeführt. Die Boost-Impl wird weithin empfohlen, sie kommt einer Standard-Lib am nächsten. Für Ringbuffer gibt es diverse Alternativen, aber für Multi-Producer / Multi-Consumer-Queue habe ich ansonsten nur Einzelfall-Implementierungen gefunden +

+ +
+
+ + + + + + + + + + + + + + + + + + + +