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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3e3949298ed3b36 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed.wirehub.nl!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: High CPU in tasking Date: Fri, 25 Jun 2004 07:34:33 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: <2k0fllF160eotU1@uni-berlin.de> <2k1114F15uoj8U1@uni-berlin.de> NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1088148873 23008 217.17.192.37 (25 Jun 2004 07:34:33 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Fri, 25 Jun 2004 07:34:33 +0000 (UTC) User-Agent: slrn/0.9.8.0 (Linux) Xref: g2news1.google.com comp.lang.ada:1876 Date: 2004-06-25T07:34:33+00:00 List-Id: * Nick Roberts wrote: > "Lutz Donnerhacke" wrote in message >> > Do you not have a separate buffer for each reader (of a single >> > demultiplexed stream)? >> >> Yep. I do have a ringbuffer with a single "writer" and an indetermined >> number of "readers". The data structure is a protected type with an entry >> family for all readers. > > Would it be possible to have a separate protected object container a buffer > for each reader? In this case, the writer has to fill an unconstraint array of ringbuffers. This seems much more inefficient. > The idea is that the writer task: accepts a data packet; determines which > reader it belongs to; Every data belongs to every reader. It's a manifolder which clones the whole data to many receivers. > If this approach is possible, I think it might more neatly solve your > problem ... The problem is solved. I published my solution to point others to this pitfall. >> All the same. I'm currently testing with a data source of 1GB/h and eight >> data sources of about half the rate. Each data source allocates a >> ringbuffer. > > ... especially if you make the writer a higher priority than all the > readers. Why? This would cause the writer to overwrite the ringbuffer without any reading access. >> There are controlling tasks: A logger task writing to /dev/log, because >> syslog(3) is not thread safe, and a supervisor task for handling the >> commands on each the TCP session. > > I suggest the logger task should made a lower priority than all the other > tasks (so that it tends to work in the gaps between reader and writer > activity). I suggest the supervisor task be made a higher priority than all > the other tasks, so as to minimise any delay in acting on incoming commands > (such as 'stop' ;-) The whole program is event triggered. There are no free running code sequences. The only effect I can imagine will be a deadlock ;-)