comp.lang.ada
 help / color / mirror / Atom feed
From: Wiktor Moskwa <wiktorDOTmoskwa@gmail.com>
Subject: Re: Workqueues in Ada
Date: Sat, 28 Jul 2007 17:52:29 +0000 (UTC)
Date: 2007-07-28T17:52:29+00:00	[thread overview]
Message-ID: <f8fvot$90e$1@atlantis.news.tpi.pl> (raw)
In-Reply-To: 4rvzewqs9ba3$.pluy1xzoi5lr$.dlg@40tude.net

On 28.07.2007, Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:
> I thought Ada.Containers.Doubly_Linked_Lists can move elements between
> lists without copying. Have you checked that?

I think the problem is that each time a task takes a unit from the queue
Delete is called and just after it Append - without a custom storage
pool malloc and free are called very often.

> You could also try an alternative implementation of doubly-linked lists and
> webs:
>
> http://www.dmitry-kazakov.de/ada/components.htm#Generic_Doubly_Linked_Web

It looks promising, especially with an ability to pass a storage pool
as a generic parameter. I'll check it out.

> Make it a protected object. A worker task calls to an entry of, requesting
> an item of work. The entry removes the first item from the list and returns
> it to the task via pointer. When the worker task finishes dealing with the
> item it calls to a protected object's procedure to queue the item back.

That's how it works now - I forgot to mention that my list is wrapped in 
a protected object, otherwise it wouldn't work :)
My idea of using a circular list is to call Delete and Append only when
new node joins the system or an old one leaves. During normal operations
a task will request new unit of work without deleting it from the queue.
It will be only marked as "currently in use". Other tasks will skip
this node - Next_To_Service pointer will move clockwise skipping nodes
that are serviced at the moment.

Thanks for your reply Dmitry.

-- 
Wiktor Moskwa



  reply	other threads:[~2007-07-28 17:52 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 [this message]
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
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