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!feeder3.cambrium.nl!feeder6.cambrium.nl!feed.tweaknews.nl!feed.xsnews.nl!border-1.ams.xsnews.nl!news.germany.com!news-stu1.dfn.de!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: Sun, 29 Jul 2007 19:53:47 +0000 (UTC) Organization: tp.internet - http://www.tpi.pl/ Message-ID: References: <4rvzewqs9ba3$.pluy1xzoi5lr$.dlg@40tude.net> <16fd0klj7ul1d$.oi8lp7eybgxo$.dlg@40tude.net> <15uu62psl9ppr$.1r30bgl24romy.dlg@40tude.net> NNTP-Posting-Host: aaer81.neoplus.adsl.tpnet.pl X-Trace: nemesis.news.tpi.pl 1185738827 27815 83.4.121.81 (29 Jul 2007 19:53:47 GMT) X-Complaints-To: usenet@tpi.pl NNTP-Posting-Date: Sun, 29 Jul 2007 19:53:47 +0000 (UTC) User-Agent: slrn/0.9.8.1 (Linux) Xref: g2news2.google.com comp.lang.ada:1263 Date: 2007-07-29T19:53:47+00:00 List-Id: On 29.07.2007, Dmitry A. Kazakov wrote: > > Doesn't it have "move X from the list A to the list B?" That should not > have any node allocation / deallocation overhead. In "simple components" > Append, Insert, Prepend have a version which takes the item from another or > same list and places it where required. Unfortunately it doesn't have such operation. But I'm playing with your components at the moment. >> Could you elaborate the concept of having an additional list of items >> per task? When it can be useful? I'm interested. > > The concept is that interlocking of the items is list-based. So you have > lists: > > Waiting_For_Service -- Nobody touches this > Being_Serviced_By_Worker_1 -- Only the worker 1 has access > Being_Serviced_By_Worker_2 -- Only the worker 2 has access > ... > > You create items of work only once and then just move them across the > lists. Nobody can do any harm to an item which is not in its list. This is > the standard way OS schedulers and I/O systems are designed. Now I see, thanks for clarification. >> If you could write more about using more lists... thanks! > > OK, I'll bite, here is a working implementation of. It uses simple > components, but I guess you could do something equivalent with > Ada.Containers, probably it would require adding a list to each worker and > using move-service-move instead of remove-service-append. Anyway: > > [...] > > Here 5 workers are printing 9 different texts. GNAT implementation of > Put_Line is interlocked, so you would not see a mess of characters, but > properly formed lines in some arbitrary order. > > Observe that the program will never end. You should add some on-exiting > stuff, which I have omitted to simplify the program. Upon exiting you would > terminate workers and clean the queue up. Thanks for your replies and an example. I'll implement a list per worker using your "webs" and see how it works. -- Wiktor Moskwa