Shared memory

From ThorstensHome
Revision as of 10:09, 18 October 2008 by WikiSysop (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Here is an example how two processes communicate using shared memory with PHP on Linux:

tstaerk@tstaerk-laptop:~$ cat test.php
<?
$shm=shm_attach(2);
shm_put_var($shm,1,"blah");
echo shm_get_var($shm,1);
?>
tstaerk@tstaerk-laptop:~$ cat test2.php
<?
$shm=shm_attach(2);
echo shm_get_var($shm,1);
?>
tstaerk@tstaerk-laptop:~$ php test.php
blahtstaerk@tstaerk-laptop:~$ php test2.php
blahtstaerk@tstaerk-laptop:~$ 

See also