From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,92a027c293f03acb X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!univ-lyon1.fr!news.uni-stuttgart.de!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail From: Wiktor Moskwa Newsgroups: comp.lang.ada Subject: Re: Workqueues in Ada Date: Sat, 28 Jul 2007 17:52:29 +0000 (UTC) Organization: tp.internet - http://www.tpi.pl/ Message-ID: References: <4rvzewqs9ba3$.pluy1xzoi5lr$.dlg@40tude.net> NNTP-Posting-Host: aaeo146.neoplus.adsl.tpnet.pl X-Trace: atlantis.news.tpi.pl 1185645149 9230 83.4.118.146 (28 Jul 2007 17:52:29 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Sat, 28 Jul 2007 17:52:29 +0000 (UTC) User-Agent: slrn/0.9.8.1 (Linux) Xref: g2news2.google.com comp.lang.ada:1239 Date: 2007-07-28T17:52:29+00:00 List-Id: On 28.07.2007, Dmitry A. Kazakov 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