Forums

Common name for a "Task Loop"

Started by Tim Wescott June 24, 2016
So, this is the third time in a month or so that I've needed to tell 
someone "use a task loop" -- but I'm not sure if I can say "just Google 
it".

So: When I say "task loop" I mean that I'm _not_ using an RTOS, but 
rather that I'm doing some small thing in a small processor, and 
somewhere in my code there's a loop that goes:

  for (;;)
  {
    if (task_1_ready)
    {
      task_1_update();
    }
    else if (task_2_ready)
    {
      task_2_update();
    }
    else if (task_3_ready)
    // et cetera
  }

The "task_n_ready" variables are set offstage (in an ISR, or by one of 
the task_n_update functions) and reset within the tasks.

So -- is there a common Google-able term for this?

-- 

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

I'm looking for work -- see my website!
Le 24/06/2016 à 20:37, Tim Wescott a écrit :
> So, this is the third time in a month or so that I've needed to tell > someone "use a task loop" -- but I'm not sure if I can say "just Google > it". > > So: When I say "task loop" I mean that I'm _not_ using an RTOS, but > rather that I'm doing some small thing in a small processor, and > somewhere in my code there's a loop that goes: > > for (;;) > { > if (task_1_ready) > { > task_1_update(); > } > else if (task_2_ready) > { > task_2_update(); > } > else if (task_3_ready) > // et cetera > } > > The "task_n_ready" variables are set offstage (in an ISR, or by one of > the task_n_update functions) and reset within the tasks. > > So -- is there a common Google-able term for this? >
https://en.wikibooks.org/wiki/Embedded_Systems/Super_Loop_Architecture
On 24.6.16 21:37, Tim Wescott wrote:
> So, this is the third time in a month or so that I've needed to tell > someone "use a task loop" -- but I'm not sure if I can say "just Google > it". > > So: When I say "task loop" I mean that I'm _not_ using an RTOS, but > rather that I'm doing some small thing in a small processor, and > somewhere in my code there's a loop that goes: > > for (;;) > { > if (task_1_ready) > { > task_1_update(); > } > else if (task_2_ready) > { > task_2_update(); > } > else if (task_3_ready) > // et cetera > } > > The "task_n_ready" variables are set offstage (in an ISR, or by one of > the task_n_update functions) and reset within the tasks. > > So -- is there a common Google-able term for this?
How about round-robin scheduling? It includes the idea of allocating time slices to tasks, which a simple task loop does not do. -- -TV
Tim Wescott wrote:
> So, this is the third time in a month or so that I've needed to tell > someone "use a task loop" -- but I'm not sure if I can say "just Google > it". > > So: When I say "task loop" I mean that I'm _not_ using an RTOS, but > rather that I'm doing some small thing in a small processor, and > somewhere in my code there's a loop that goes: > > for (;;) > { > if (task_1_ready) > { > task_1_update(); > } > else if (task_2_ready) > { > task_2_update(); > } > else if (task_3_ready) > // et cetera > } > > The "task_n_ready" variables are set offstage (in an ISR, or by one of > the task_n_update functions) and reset within the tasks. > > So -- is there a common Google-able term for this? >
I've seen: - task loop - The Big Loop - "bare metal" - A "no O/S" solution. Google is no help at all. It's apparently sufficiently obscure to defy standard naming. -- Les Cargill
On Fri, 24 Jun 2016 14:51:55 -0500, Les Cargill wrote:

> Tim Wescott wrote: >> So, this is the third time in a month or so that I've needed to tell >> someone "use a task loop" -- but I'm not sure if I can say "just Google >> it". >> >> So: When I say "task loop" I mean that I'm _not_ using an RTOS, but >> rather that I'm doing some small thing in a small processor, and >> somewhere in my code there's a loop that goes: >> >> for (;;) >> { >> if (task_1_ready) >> { >> task_1_update(); >> } >> else if (task_2_ready) >> { >> task_2_update(); >> } >> else if (task_3_ready) >> // et cetera >> } >> >> The "task_n_ready" variables are set offstage (in an ISR, or by one of >> the task_n_update functions) and reset within the tasks. >> >> So -- is there a common Google-able term for this? >> >> > > I've seen: > > - task loop > - The Big Loop > - "bare metal" > - A "no O/S" solution. > > Google is no help at all. > > It's apparently sufficiently obscure to defy standard naming.
That's kind of what I found, too. It's a form of non-preemptive multitasking, but it's by no means the only way to implement that, so you can't really call it that. Which is odd, because if you were to count actual processors out there then some variant of it is probably the most Embedded architecture. -- Tim Wescott Control systems, embedded software and circuit design I'm looking for work! See my website if you're interested http://www.wescottdesign.com
Tim Wescott wrote:

> So, this is the third time in a month or so that I've needed to tell > someone "use a task loop" -- but I'm not sure if I can say "just Google > it". > > So: When I say "task loop" I mean that I'm _not_ using an RTOS, but > rather that I'm doing some small thing in a small processor, and > somewhere in my code there's a loop that goes: > > for (;;) > { > if (task_1_ready) > { > task_1_update(); > } > else if (task_2_ready) > { > task_2_update(); > } > else if (task_3_ready) > // et cetera > } > > The "task_n_ready" variables are set offstage (in an ISR, or by one of > the task_n_update functions) and reset within the tasks. > > So -- is there a common Google-able term for this? >
I've always called it while(1)OS. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.
On Fri, 24 Jun 2016 21:04:12 +0200, Lanarcam wrote:

> Le 24/06/2016 à 20:37, Tim Wescott a écrit : >> So, this is the third time in a month or so that I've needed to tell >> someone "use a task loop" -- but I'm not sure if I can say "just Google >> it". >> >> So: When I say "task loop" I mean that I'm _not_ using an RTOS, but >> rather that I'm doing some small thing in a small processor, and >> somewhere in my code there's a loop that goes: >> >> for (;;) >> { >> if (task_1_ready) >> { >> task_1_update(); >> } >> else if (task_2_ready) >> { >> task_2_update(); >> } >> else if (task_3_ready) >> // et cetera >> } >> >> The "task_n_ready" variables are set offstage (in an ISR, or by one of >> the task_n_update functions) and reset within the tasks. >> >> So -- is there a common Google-able term for this? >> > https://en.wikibooks.org/wiki/Embedded_Systems/Super_Loop_Architecture
Hmm. That actually gets some hits. There seems to be no consensus on these terms, though. -- Tim Wescott Control systems, embedded software and circuit design I'm looking for work! See my website if you're interested http://www.wescottdesign.com
On 6/24/2016 11:37 AM, Tim Wescott wrote:
> So, this is the third time in a month or so that I've needed to tell > someone "use a task loop" -- but I'm not sure if I can say "just Google > it". > > So: When I say "task loop" I mean that I'm _not_ using an RTOS, but > rather that I'm doing some small thing in a small processor, and > somewhere in my code there's a loop that goes: > > for (;;) > { > if (task_1_ready) > { > task_1_update(); > } > else if (task_2_ready) > { > task_2_update(); > } > else if (task_3_ready) > // et cetera > } > > The "task_n_ready" variables are set offstage (in an ISR, or by one of > the task_n_update functions) and reset within the tasks. > > So -- is there a common Google-able term for this?
It's a variant of foreground-background. There's no explicit scheduling (other than the ISR's coming along "whenever they wish"). Whether the background is a big loop or a straight shot of code is up to the "application". I've used (*really* slim!) multitasking executives that used the loop as a general framework for "scheduling" tasks -- but allowed voluntary rescheduling directives to be invoked by the individual "function calls" invoked from that loop: main() { while (FOREVER) { task1(); task2(); task3(); } } Or, more cleverly: main() { while (FOREVER) { low_priority_tasks(); medium_priority_tasks(); medium_priority_tasks(); high_priority_tasks(); high_priority_tasks(); high_priority_tasks(); high_priority_tasks(); } } low_priority_tasks() { task1(); task9(); task3(); } ... high_priority_tasks() { task5(); task2(); task7(); } I.e., moving a task() from one wrapping function (low/medium/high) to another effectively alters its quantum. This can be salted: main() { while (FOREVER) { low_priority_tasks(); low_latency_tasks(); medium_priority_tasks(); low_latency_tasks(); medium_priority_tasks(); low_latency_tasks(); high_priority_tasks(); low_latency_tasks(); high_priority_tasks(); low_latency_tasks(); high_priority_tasks(); low_latency_tasks(); high_priority_tasks(); low_latency_tasks(); } } so tasks that need to be serviced "in short order" can gain a share of the processor "more frequently".
In article <nkk45h$4nl$1@dont-email.me>,
Rob Gaddi  <rgaddi@highlandtechnology.invalid> wrote:
>Tim Wescott wrote: > >> So, this is the third time in a month or so that I've needed to tell >> someone "use a task loop" -- but I'm not sure if I can say "just Google >> it". >> >> So: When I say "task loop" I mean that I'm _not_ using an RTOS, but >> rather that I'm doing some small thing in a small processor, and >> somewhere in my code there's a loop that goes: >> >> for (;;) >> { >> if (task_1_ready) >> { >> task_1_update(); >> } >> else if (task_2_ready) >> { >> task_2_update(); >> } >> else if (task_3_ready) >> // et cetera >> } >> >> The "task_n_ready" variables are set offstage (in an ISR, or by one of >> the task_n_update functions) and reset within the tasks. >> >> So -- is there a common Google-able term for this? >> > >I've always called it while(1)OS.
Rob - that's what I've always called it too. Not really Google-able however... --Mark
Tim Wescott <seemywebsite@myfooter.really> writes:
> So, this is the third time in a month or so that I've needed to tell > someone "use a task loop" -- but I'm not sure if I can say "just Google > it".
I'd call that a polling loop, since it polls each task to see if it's ready. But I don't know if that's a standard term. There's a DSL for generating these things (see "Atom" under http://tomahawkins.org) and the slide presentation doesn't seem to use any particular name for the main loop.