Scheduler-test: address follow-up problem with depth-first

The rework from yesterday turned out to be effective ... unfortunately
a bit to much: since now late follow-up notifications take precedence,
a single worker tends to process the complete chain depth-first, because
the first chain will be followed and processed, even before the worker
was able to post the tasks for the other branches. Thus this single
worker is the only one to get a chance to proceed.

After some consideration, I am now leaning towards a fundamental change,
instead of just fixing some unfavourable behaviour pattern: while the
language semantics remains the same, the scheduler should no longer
directly dispatch into the next chain **from λ-post**. That is, whenever
a POST / NOTIFY is issued from the Activity-chain, the scheduler goes
through prioritisation.

This has further ramifications: we do not need a self-inhibition mechanism
any more (since now NOTIFY picks up the schedule time of the target).

With these changes, processing seems to proceed more smoothly,
albeit still with lots of contention on the Grooming token,
at least in the example structure tested here.
This commit is contained in:
Fischlurch 2023-12-17 23:46:44 +01:00
parent 1cbb6b7371
commit ba82a446fd
4 changed files with 861 additions and 54 deletions

View file

@ -262,10 +262,18 @@ namespace gear {
if (decideDispatchNow (event.startTime(), now))
return ActivityLang::dispatchChain (event, executionCtx);
else
if (holdsGroomingToken (thisThread()))
layer1.feedPrioritisation (move (event));
else
layer1.instruct (move (event));
instructFollowUp (event,layer1);
return activity::PASS;
}
activity::Proc
instructFollowUp (ActivationEvent event
,SchedulerInvocation& layer1 )
{
if (holdsGroomingToken (thisThread()))
layer1.feedPrioritisation (move (event));
else
layer1.instruct (move (event));
return activity::PASS;
}
};

View file

@ -526,8 +526,8 @@ namespace gear {
chainEvent.activity = chain;
chainEvent.starting = _raw(chain->constrainedStart (when));
chainEvent.deadline = _raw(chain->constrainedDeath (dead.isRegular()? dead:chainEvent.deathTime()));
ExecutionCtx subCtx{scheduler_, chainEvent};
return scheduler_.layer2_.postDispatch (chainEvent, subCtx, scheduler_.layer1_);
// ExecutionCtx subCtx{scheduler_, chainEvent};
return scheduler_.layer2_.instructFollowUp (chainEvent, scheduler_.layer1_);
}
/**

View file

@ -583,7 +583,7 @@ SHOW_EXPR(referenceTime)
testLoad.setupSchedule(scheduler)
.withLoadTimeBase(LOAD_BASE)
.withJobDeadline(100ms)
.requireSchedule()
// .requireSchedule()
.launch_and_wait();
// invocation through Scheduler has reproduced all node hashes

File diff suppressed because it is too large Load diff