Sujet : Re: Continuations
De : niklas.holsti (at) *nospam* tidorum.invalid (Niklas Holsti)
Groupes : comp.archDate : 15. Jul 2024, 21:06:13
Autres entêtes
Organisation : Tidorum Ltd
Message-ID : <lfldplF1kmoU1@mid.individual.net>
References : 1 2 3 4 5
User-Agent : Mozilla Thunderbird
On 2024-07-14 23:29, John Levine wrote:
According to Niklas Holsti <niklas.holsti@tidorum.invalid>:
This programming style is very old. The SAGE air defense system used
it in the 1950s, and SABRE copied it in the early 1960s. The software
was oranizaed into routines each of which took some input, did
something with it, perhaps scheduled other I/O operations, and then
explicitly saved its state and returned to the dispatcher.
>
I think that looks more like a multi-tasking system with
run-to-completion, non-preemptive (small) tasks, considering each
"routine" as a task and assuming that each routine started with
recovering its saved context.
Right, that saved context is the continuation. Like I said, the tools
these days take care of a lot of the drudge work, e.g. node.js.
The main difference to present-day multi-tasking systems is then that
the context-saving and -restoring was implemented separately and
specifically in each task, and not in a shared "task switch" function.
Not really. The context is specific to each routine. It's not like
time-slicing, it's do as much work as you can and then block for I/O.
The context you save depends on what you're doing.
Yes yes, as I said, the "tasks" (analogous to routines) are run-to-completion, not time-sliced, and the context save/load is "specifically" in each "task".
Special systems like SAGE and SABRE can be viewed with different "eyes" for comparing to current concepts. You look at them with "continuation passing" eyes; I use my "run-to-completion, non-preemptive multitasking" eyes, perhaps because I am more familiar with that kind of SW design.
For me the deciding factor in SAGE/SABRE is that the dispatcher, to which each routine performs a call-with-continuation (in your view), is /not/ an application function, but a system function, and is indeed a scheduler that finds some new routine to execute /which the calling routine did not choose/.
IMO, for something to qualify as a continuation-passing call, the caller should select the callee -- the thing to be executed next -- but in SAGE/SABRE it is the scheduler that selects what to execute next.