comp.lang.ada
 help / color / mirror / Atom feed
From: Wiktor Moskwa <wiktorDOTmoskwa@gmail.com>
Subject: Workqueues in Ada
Date: Sat, 28 Jul 2007 17:00:57 +0000 (UTC)
Date: 2007-07-28T17:00:57+00:00	[thread overview]
Message-ID: <f8fso9$erg$1@nemesis.news.tpi.pl> (raw)

Hello,

Few months ago I wrote about a distributed protocol simulator that
I was writing in Ada. I followed an advice to stop using a thread per
node and to implement a worker thread pool.
With the new architecture things improved a lot, all the overhead
of context switching has gone.

I defined a unit of work as one iteration of one node (checking if
new messages have come, processing messages, sending responses,
checking if it's time to run a periodic job, updating statistic).
I have a workqueue of above units and a pool of tasks that service
nodes.

The problem is that my poor implementation of workqueue is a 
bottleneck. A task takes a unit of work from a queue, processes it 
and puts it back at the and of the queue. Because the queue is 
Ada.Containers.Doubly_Linked_Lists there are lots of memory
allocations and deallocations - that's a performance problem.

I consider making a circular list of nodes with "Next_To_Service"
pointer going around as nodes are processed. I'll have to make
sure that one node can be served by only one task at the time
(probably by marking nodes as being served at the moment).
New nodes joining and old leaving the system will be more
difficult to implement correctly, I suppose.

What can you suggest?
I'm probably missing something obvious. 
Thanks in advance!

-- 
Wiktor Moskwa



             reply	other threads:[~2007-07-28 17:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-28 17:00 Wiktor Moskwa [this message]
2007-07-28 17:28 ` Workqueues in Ada 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
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