comp.lang.ada
 help / color / mirror / Atom feed
From: Wiktor Moskwa <wiktorDOTmoskwa@gmail.com>
Subject: Re: Workqueues in Ada
Date: Sat, 28 Jul 2007 21:19:10 +0000 (UTC)
Date: 2007-07-28T21:19:10+00:00	[thread overview]
Message-ID: <f8gbse$kc6$1@nemesis.news.tpi.pl> (raw)
In-Reply-To: 16fd0klj7ul1d$.oi8lp7eybgxo$.dlg@40tude.net

On 28.07.2007, Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:
> Why? What I don't understand is why removing from a queue should deallocate
> anything. It might be an artefact of Ada.Containers, but in general case it
> is not unnecessary. Removing just means that it is the task who will hold
> the item. Technically the item will be either in no list or in the list of
> one item long owned by the task. You have one list of items waiting for
> service and n lists of items being serviced, where n = number of worker
> tasks. Interlocking is only necessary when you move an item from list to
> list.

In GNAT GPL 2007 implementation of Doubly_Linked_Lists an Element is kept
in a limited record called Node. When Append is called, new Node is
created and when Delete - Free(Node) is called. Everything happens in
a default storage pool and is transpated to malloc and free.

Could you elaborate the concept of having an additional list of items
per task? When it can be useful? I'm interested.

> If you do this you would not need any lists, just a ring buffer of items.

That's the name I was looking for :)

> With a relatively small number of worker tasks the overhead of skipping
> items in use is not that big, but you will have another potential problem:
> unbalanced servicing. When an item was serviced a bit longer than its
> neighbours, it might miss its train of servicing. What is worse it could
> become a systematic problem for some items with a huge impact in result.

I agree, I haven't consider balancing yet.

> Doubly-linked lists do not have this problem, while removing and inserting
> overhead is just negligible. You can shuffle items between lists very
> efficiently.

If you could write more about using more lists... thanks!

-- 
Wiktor Moskwa



  reply	other threads:[~2007-07-28 21:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-28 17:00 Workqueues in Ada Wiktor Moskwa
2007-07-28 17:28 ` Dmitry A. Kazakov
2007-07-28 17:52   ` Wiktor Moskwa
2007-07-28 19:53     ` Simon Wright
2007-07-28 21:25       ` Wiktor Moskwa
2007-07-28 20:45     ` Dmitry A. Kazakov
2007-07-28 21:19       ` Wiktor Moskwa [this message]
2007-07-29  8:36         ` Dmitry A. Kazakov
2007-07-29 19:53           ` Wiktor Moskwa
2007-07-30  6:47             ` Niklas Holsti
2007-07-30 15:56               ` Matthew Heaney
2007-07-30 15:53             ` Matthew Heaney
2007-07-30 19:57               ` Wiktor Moskwa
2007-07-30 15:52           ` Matthew Heaney
2007-07-31 20:54             ` Wiktor Moskwa
2007-08-01  8:30               ` Dmitry A. Kazakov
2007-07-28 17:31 ` Jeffrey R. Carter
2007-07-28 17:56   ` Wiktor Moskwa
2007-07-28 20:18   ` Wiktor Moskwa
2007-07-28 20:48     ` Robert A Duff
2007-07-28 21:03       ` Wiktor Moskwa
2007-07-28 21:38         ` Robert A Duff
2007-07-28 22:12           ` Wiktor Moskwa
2007-07-29  0:30             ` Robert A Duff
2007-07-29  6:38               ` Jeffrey R. Carter
2007-07-29  6:34           ` Jeffrey R. Carter
2007-07-29  6:30     ` Jeffrey R. Carter
2007-07-28 21:54 ` Robert A Duff
2007-07-30 15:48 ` Matthew Heaney
replies disabled

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