comp.lang.ada
 help / color / mirror / Atom feed
From: Brad Moore <brad.moore@shaw.ca>
Subject: Re: Structure of the multitasking server
Date: Sun, 15 Mar 2015 10:04:12 -0600
Date: 2015-03-15T10:04:12-06:00	[thread overview]
Message-ID: <V3iNw.63652$0x4.61836@fx09.iad> (raw)
In-Reply-To: <87egoqmxa8.fsf@adaheads.sparre-andersen.dk>

On 15-03-15 03:21 AM, Jacob Sparre Andersen wrote:
> J-P. Rosen wrote:
>
>> If you give the producer a lower priority than the workers, it will be
>> activated only when workers are done, and busy waiting is no more a
>> problem.

I use this approach in the Ravenscar Paraffin libraries.

Note though, that this approach only works on real-time systems, which implement the priority model.

Linux (and Windows) for example by default doesn't do this, so the spinning of the lower priority task can interfere
with the higher priority tasks running on the same core. If you are using a flavor of Linux that has been configured for
real-time then you should be able to rely on this behaviour.

   See
     https://rt.wiki.kernel.org/index.php/RT_PREEMPT_HOWTO#About_the_RT-Preempt_Patch

Otherwise, this approach doesn't really work (it works but inefficient because CPU is wasted on spinning),
so you should use blocking instead of spin waiting.
In Paraffin, I provide two versions of Ravenscar libraries (one blocking, and one spinning), so that you can use
whichever version best suits your OS.

Brad

>
> Nice solution. :-)
>
> Greetings,
>
> Jacob
>



  reply	other threads:[~2015-03-15 16:04 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 12:21 Structure of the multitasking server Maciej Sobczak
2008-09-19 13:34 ` Jean-Pierre Rosen
2008-09-19 17:02   ` Dmitry A. Kazakov
2008-09-21 17:30     ` Maciej Sobczak
2008-09-21 19:24       ` Dmitry A. Kazakov
2008-09-21 21:27         ` Maciej Sobczak
2008-09-22  8:12           ` Dmitry A. Kazakov
2008-09-22 12:47             ` Maciej Sobczak
2008-09-22 14:11               ` Dmitry A. Kazakov
2008-09-23  8:07                 ` Maciej Sobczak
2008-09-23  9:37                   ` Dmitry A. Kazakov
2008-09-23 10:47                   ` Jean-Pierre Rosen
2008-09-21 17:23   ` Maciej Sobczak
2008-09-22  8:23     ` Jean-Pierre Rosen
2015-03-12 16:07   ` gautier_niouzes
2015-03-12 21:38     ` Jacob Sparre Andersen
2015-03-12 22:39       ` gautier_niouzes
2015-03-13  8:15         ` Dmitry A. Kazakov
2015-03-13 20:16           ` gautier_niouzes
2015-03-13 20:47             ` Dmitry A. Kazakov
2015-03-15  7:43               ` gautier_niouzes
2015-03-15  8:35                 ` Simon Wright
2015-03-15  8:52                 ` J-P. Rosen
2015-03-15  9:21                   ` Jacob Sparre Andersen
2015-03-15 16:04                     ` Brad Moore [this message]
2015-03-13 23:04             ` Randy Brukardt
2015-03-14  8:22               ` Simon Wright
2008-09-19 23:01 ` anon
2008-09-21 17:37   ` Maciej Sobczak
2008-09-22  2:32     ` anon
2008-09-22 13:05       ` Maciej Sobczak
2008-09-23  9:25         ` anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox