[comp.sys.mac.programmer] Shared memory

marty@cernvax.cern.ch (hugues marty) (11/23/90)

I would like to communicate between two applications. It should
work under system 6.x.x AND 7.0.

Is there a way of having shared memory? I don't want to use a driver.
I thought of allocating a non-relocatable block in the system heap
(yes, the system heap) and pass the address via a file. Is it a good
way?

Suggestions welcome.
Hugues Marty


-- 
e+ ---->?<---- e- :Les Chercheurs de Bosons Unifies: marty@cernvax.cern.ch

time@tbomb.ice.com (Tim Endres) (11/25/90)

In article <3171@cernvax.cern.ch>, marty@cernvax.cern.ch (hugues marty) writes:
> Is there a way of having shared memory? I don't want to use a driver.
> I thought of allocating a non-relocatable block in the system heap
> (yes, the system heap) and pass the address via a file. Is it a good
> way?
> 

This is perfectly valid depending on your case.

First, the file mechanism leaves a lot to be desired in terms of checking
for validity etc, but will work.

Second, you need to determine your memory requirements. If they are
very small ( < 2048 ) then you can usually the system heap space from
within an application, but if the requirements are large (> 4K), then
you will need some type of INIT to get the space at boot time.

Third, if you wind up needing an INIT, you may as well write a driver!

Finally, sample driver code to do all of this is available.

tim.

-------------------------------------------------------------
Tim Endres                |  time@ice.com
ICE Engineering           |  uunet!ice.com!time
8840 Main Street          |
Whitmore Lake MI. 48189   |  (313) 449 8288

francis@daisy.uchicago.edu (Francis Stracke) (11/27/90)

In article <1CE00001.6q9i4t@tbomb.ice.com> time@tbomb.ice.com writes:
>
>In article <3171@cernvax.cern.ch>, marty@cernvax.cern.ch (hugues marty) writes:
>> Is there a way of having shared memory? I don't want to use a driver.
[...]
>Second, you need to determine your memory requirements. If they are
>very small ( < 2048 ) then you can usually the system heap space from
>within an application, but if the requirements are large (> 4K), then
>you will need some type of INIT to get the space at boot time.
>
>Third, if you wind up needing an INIT, you may as well write a driver!

Why? The memory allocation can be done without code, using
the 'sysz' resource.  What else do you really need? (I suppose the
INIT might have trouble writing a file... But maybe you could check
through the system heap for a block of the right size containing
some sort of signature your INIT had put in.)

| Francis Stracke		| My opinions are my own.  I don't steal them.|
| Department of Mathematics	|=============================================|
| University of Chicago		| Until you stalk and overrun,	     	      |
| francis@zaphod.uchicago.edu	|  you can't devour anyone. -- Hobbes 	      |