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,ffe4fb1477fe67e6 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!w5g2000hsg.googlegroups.com!not-for-mail From: ezkcdude Newsgroups: comp.lang.ada Subject: Re: Memory mapped files and shared memory (Was: Newbie Needs Ada Advice) Date: 11 May 2007 09:38:38 -0700 Organization: http://groups.google.com Message-ID: <1178901518.742268.38300@w5g2000hsg.googlegroups.com> References: <1178212418.538270.283700@c35g2000hsg.googlegroups.com> <1178635220.859690.3310@y80g2000hsf.googlegroups.com> <5abtplF2n3855U1@mid.individual.net> <1178650313.462774.91850@e51g2000hsg.googlegroups.com> <1178659640.093325.10510@y5g2000hsa.googlegroups.com> <6lvef2aszy.fsf@hod.lan.m-e-leypold.de> NNTP-Posting-Host: 169.147.3.25 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1178901522 6378 127.0.0.1 (11 May 2007 16:38:42 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 11 May 2007 16:38:42 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: w5g2000hsg.googlegroups.com; posting-host=169.147.3.25; posting-account=UbN39Q0AAADjt_3dTnzY1z4Qc9xnXw4K Xref: g2news1.google.com comp.lang.ada:15758 Date: 2007-05-11T09:38:38-07:00 List-Id: On May 10, 4:20 pm, Jacob Sparre Andersen wrote: > Markus E Leypold wrote: > > Jacob Sparre Andersen writes: > >> File names are slow. Wouldn't it be more appropriate to keep the > >> currently relevant image(s) in a shared memory segment? > > > Dependents on what you want to do. Probably not the whole 30 GB. My > > rule of thumb always is to do the elementary thing first and > > optimize later. > > In general that is also what I do, but isn't it simpler to store the > whole sequence of images in an array of images? Mapping that array > into a file/shared memory segment costs you around 20 lines of code > (even with my rather extravagant use of linebreaks). > > There is one catch: I am not sure that the Ada interface to POSIX > systems is required to support memory maps as large as 30 Gb. > (Additionally I suspect that the original poster isn't using a POSIX > system.) > > > In this case one could use the file storage (one use it anyway), > > introduce (when required) the shared memory for explicit caching (or > > perhaps play with memory mapping the file) and refine the > > get-the-image protocol appropriately. My gut feeling though is, to > > trust the file system cache of the machine to do the proper caching > > implicitely and there should be a good reason to think you can do > > better than that manually. > > Using memory maps goes even further in leaving the caching/swapping > decisions to the operating systems, than copying individual images to > and from files. > > Greetings, > > Jacob > -- > recursive, adj.; see recursive So, what's the bottom line? If my application needs to write images as fast as possible to disk, how should one go about doing that? And is Ada as good as any other low-level programming language for this task? On a related topic, would it be helpful to have very fast hard drives in a RAID 0 configuration? I'm wondering if that would automatically speed up things, or would I have to somehow take advantage of that in the Ada program...