Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #27938

Re: "Boost context" for task switching on embedded Linux on ARM

From Niklas Holsti <niklas.holsti@tidorum.invalid>
Newsgroups comp.arch.embedded
Subject Re: "Boost context" for task switching on embedded Linux on ARM
Date 2018-08-04 11:13 +0300
Organization Tidorum Ltd
Message-ID <fsl5geF1tmvU1@mid.individual.net> (permalink)
References <22dc63b2-4d1d-4a5c-842a-4ec4727989e5@googlegroups.com> <5vhamd9iq9o08nbo8ihumfhnpjemh3b9k0@4ax.com>

Show all headers | View raw


On 18-08-04 10:28 , George Neuner wrote:
> On Fri, 3 Aug 2018 05:52:01 -0700 (PDT), gp.kiwi@gmail.com wrote:
>
>> Following on from my recent question about PThreads I have a new question
>> about Boost:context
>> https://www.boost.org/doc/libs/1_67_0/libs/context/doc/html/index.html
>>
>> We have some legacy code(Motorola 68000 C) that we want to use that
>> has cooperative task switching.  We want to run it all as a single
>> thread and keep its co-operative organization within that thread.
    ...
>> Alternatively we could run each task as a thread and enforce round
>> robin behaviour but that seems a bit wasteful.
>
> That won't necessarily work.
>
> In cooperative tasking, the current task runs until it explicitly
> yields the CPU.  Often shared data is manipulated without locks
> because the programmer knows no other task can run and interrupt the
> operation.
>
> Running such a system under a pre-emptive task switcher is going to
> fail eventually regardless of the scheduling policy.

If the tasks cooperate, round-robin execution can be enforced even if 
the scheduler is "basically" pre-emptive. One just defines a mutex (with 
a waiting-task queue), and each task takes the mutex, does its job, 
releases the mutex, and repeats. If the mutex queue is FIFO, the result 
is round-robin execution of these cooperating tasks, no?

Of course no task outside this cooperating task group should access the 
unprotected, shared data.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

"Boost context" for task switching on embedded Linux on ARM gp.kiwi@gmail.com - 2018-08-03 05:52 -0700
  Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-04 03:28 -0400
    Re: "Boost context" for task switching on embedded Linux on ARM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-08-04 11:13 +0300
      Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-04 07:08 -0400
        Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-04 07:22 -0400
          Re: "Boost context" for task switching on embedded Linux on ARM graeme.prentice@gmail.com - 2018-08-04 04:49 -0700
            Re: "Boost context" for task switching on embedded Linux on ARM "gp...@gmail.com" <graeme.prentice@gmail.com> - 2018-08-04 05:25 -0700
              Re: "Boost context" for task switching on embedded Linux on ARM graeme.prentice@gmail.com - 2018-08-04 06:01 -0700
                Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-06 04:17 -0400
                Re: "Boost context" for task switching on embedded Linux on ARM Paul Rubin <no.email@nospam.invalid> - 2018-08-06 11:21 -0700
                Re: "Boost context" for task switching on embedded Linux on ARM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-08-06 22:48 +0300
                Re: "Boost context" for task switching on embedded Linux on ARM gp.kiwi@gmail.com - 2018-08-07 04:43 -0700
                Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-07 15:10 -0400
                Re: "Boost context" for task switching on embedded Linux on ARM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-08-07 22:41 +0300
                Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-08 00:42 -0400
                Re: "Boost context" for task switching on embedded Linux on ARM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-08-08 08:21 +0300
                Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-09 10:55 -0400
                Re: "Boost context" for task switching on embedded Linux on ARM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2018-08-09 22:14 +0300
            Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-06 04:04 -0400
              Re: "Boost context" for task switching on embedded Linux on ARM gp.kiwi@gmail.com - 2018-08-06 04:09 -0700
                Re: "Boost context" for task switching on embedded Linux on ARM George Neuner <gneuner2@comcast.net> - 2018-08-06 12:29 -0400

csiph-web