comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Memory mapped files and shared memory (Was: Newbie Needs Ada Advice)
Date: Thu, 10 May 2007 23:20:19 +0200
Date: 2007-05-10T23:20:19+02:00	[thread overview]
Message-ID: <ygetzukbcks.fsf_-_@hugsarin.dmusyd.edu> (raw)
In-Reply-To: 6lvef2aszy.fsf@hod.lan.m-e-leypold.de

Markus E Leypold wrote:
> Jacob Sparre Andersen <sparre@nbi.dk> 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



  reply	other threads:[~2007-05-10 21:20 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-03 17:13 Newbie Needs Ada Advice ezkcdude
2007-05-03 18:24 ` Dmitry A. Kazakov
2007-05-03 22:14   ` ezkcdude
2007-05-04  4:07 ` tmoran
2007-05-04 12:57   ` Bob Spooner
2007-05-04 13:38     ` Dmitry A. Kazakov
2007-05-04 14:40       ` ezkcdude
2007-05-04 19:19       ` Bob Spooner
2007-05-04 19:48         ` Dmitry A. Kazakov
2007-05-06 21:46           ` ezkcdude
2007-05-07  7:31             ` Dmitry A. Kazakov
2007-05-07  7:42             ` Alex R. Mosteo
2007-05-07  9:15               ` Dmitry A. Kazakov
2007-05-08  2:58             ` Justin Gombos
2007-05-08 11:58               ` ezkcdude
2007-05-04  4:42 ` Jeffrey R. Carter
2007-05-04  6:48 ` Jacob Sparre Andersen
2007-05-07  8:01 ` Markus E Leypold
2007-05-08 14:40   ` ezkcdude
2007-05-08 15:07     ` Pascal Obry
2007-05-08 15:27       ` ezkcdude
2007-05-08 15:54         ` Pascal Obry
2007-05-08 16:07         ` Georg Bauhaus
2007-05-08 18:42           ` Markus E Leypold
2007-05-08 16:18         ` Ali Bendriss
2007-05-08 19:23         ` Michael Bode
2007-05-08 16:11     ` Markus E Leypold
2007-05-08 16:49       ` ezkcdude
2007-05-08 18:20         ` Ludovic Brenta
2007-05-08 21:17           ` Markus E Leypold
2007-05-08 18:45         ` Markus E Leypold
2007-05-08 18:28     ` Alex R. Mosteo
2007-05-08 18:51       ` ezkcdude
2007-05-08 19:31         ` Michael Bode
2007-05-08 19:43           ` Michael Bode
2007-05-08 20:02         ` Dmitry A. Kazakov
2007-05-08 21:26           ` Markus E Leypold
2007-05-08 21:21         ` Markus E Leypold
2007-05-08 21:27           ` ezkcdude
2007-05-08 21:56             ` Markus E Leypold
2007-05-09 13:25               ` Jacob Sparre Andersen
2007-05-09 15:58                 ` Markus E Leypold
2007-05-10 21:20                   ` Jacob Sparre Andersen [this message]
2007-05-11 16:38                     ` Memory mapped files and shared memory (Was: Newbie Needs Ada Advice) ezkcdude
2007-05-10 18:14     ` Newbie Needs Ada Advice Chip and Allie Orange
2007-05-27  5:50     ` adaworks
2007-05-29 12:54       ` ezkcdude
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox