realbasic-nug
[Top] [All Lists]

Re: Dealing with multi-processor or multi-core (shared memory semi solut

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Dealing with multi-processor or multi-core (shared memory semi solution)
From: Charles Yeomans <charles at declareSub dot com>
Date: Fri, 30 May 2008 17:37:44 -0400
Authentication-results: mx.google.com; spf=pass (google.com: domain of realbasic-nug-bounces at lists dot realsoftware dot com designates 66.116.103.65 as permitted sender) smtp dot mail=realbasic-nug-bounces at lists dot realsoftware dot com
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <77124270805301112ja025ec1i5295f790cf52d33b at mail dot gmail dot com> <BAY107-DAV13E1BCBA0B8DD7A3965E3D93BE0 at phx dot gbl> <77124270805301302v4b6f531by1501155ebce893f at mail dot gmail dot com> <298EE353-3AE8-4792-B9D1-2E199601FBFE at mac dot com>
This is all the easy part.  The hard part is synchronized access to  
the shared data.

Charles Yeomans



On May 30, 2008, at 5:12 PM, Tom Benson wrote:

> 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>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>