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,8ab6ed0f71c479cd X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!d23g2000yqc.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: API design problem - buffer scatter I/O Date: Wed, 26 Nov 2008 00:34:18 -0800 (PST) Organization: http://groups.google.com Message-ID: <2559d62b-68bb-4107-9e6b-75f77114908f@d23g2000yqc.googlegroups.com> References: NNTP-Posting-Host: 128.141.45.238 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1227688458 19836 127.0.0.1 (26 Nov 2008 08:34:18 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 26 Nov 2008 08:34:18 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d23g2000yqc.googlegroups.com; posting-host=128.141.45.238; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3,gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:3768 Date: 2008-11-26T00:34:18-08:00 List-Id: On 24 Lis, 18:16, tmo...@acm.org wrote: > > The problem is that this is a single, continuous array. > =A0 Is this an actual problem? Not im my case, really. Actually, I made up the I/O part because I didn't want to expose the real problem case. I have still got an excellent feedback that allowed me to fill the blanks in what I do and it really helped. :-) We can still argue (for the sake of technical discussion) that the single buffer can be a problem even for real I/O, because it *might* imply the use of dynamic memory, which for some reasons we might want to avoid. Having a set of static buffers and custom scheme of associating them with the fragments of the data stream might be an interesting solution. Of course, you could still argue that in the case of real I/O it might be done with just a sequence of separate I/O calls for each involved buffer, so again scatter operation is not necessary, but then the counterargument would be for example atomicity of the whole data transfer. And so on. >=A0In most systems copying the bytes from > an IO buffer into different places will be a small percentage of the > time taken by the actual IO, so the simplicity of a single IO buffer > is worth the modest cost. Yes. But then, the I/O might be an interprocess communication based on shared memory where "copying bytes" is the only factor and therefore not at all a small percentage. And so on. ;-) -- Maciej Sobczak * www.msobczak.com * www.inspirel.com Database Access Library for Ada: www.inspirel.com/soci-ada