You can accomplish almost exactly this by using a RAM disk (at least
under OS X) - For those of you who don't know a RAM disk is a virtual
volume that exists only in RAM, giving VERY fast access speeds.
To create a RAM disk:
$ hdid -nomount ram://52428800 //byte size allocation
$ newfs_hfs /dev/disk1
$ mkdir /tmp/ramdisk1
$ mount -t hfs /dev/disk1 /tmp/ramdisk1
To unmount it when you are done
$ hdiutil detach /dev/disk1:
I'm not sure what the overhead of writing files to the RAM disk is v.
IPC sockets, but this essentially creates what you are after, no??
I've never used a RAM disk for these purposes, but if it works I
imagine these shell commands would be quite easy to wrap up into an RB
module, where you could say
folderitem = CreateSharedMemory(VolumeName,MBsize)
if folderitem <> nil then
// now folderitem points to an area of shared memory, which you can
use normal file IO functions on.
end
- Tom
On 31/05/2008, at 6:02 AM, Peter K. Stys wrote:
> On Fri, May 30, 2008 at 1:31 PM, Daniel Stenning
> <d0stenning at msn dot com> wrote:
>
>> What might help is some facility in the RB language to support
>> "shared
>> memory". This requires semaphores etc but is faster when we need
>> to share
>> big amounts of data amongst several processes ( or helper apps ).
>> Passing
>> huge chunks of data via IPC is slow.
>
>
>
> I'd second this: if multiple cores/threads/processes are needed, it's
> usually because you need to operate on a large amount of data in
> parallel.
> Sending it via IPC or Notification may take as long as crunching it
> by a
> single thread, defeating the multicore exercise.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|