Shared Memory and Synchronization

Because CAVE applications are multiprocessed, shared memory is used to communicate between processes.

Although calculations can be done in the display processes, for best performance, they should be done in a separate computation process, with the results stored in shared memory.

Shared memory is allocated from an arena. The CAVE arena is created by CAVEConfigure(), before CAVEInit() is called, so that it will be visible to the display processes. Memory can still be allocated from the arena after CAVEInit(). Shared data can be passed from the computation to the drawing processes via global pointers, or arguments to the drawing callbacks.

Functions

void * CAVEMalloc(size_t size)
Returns a pointer to a chunk of shared memory of size bytes.
This memory is allocated from the shared arena created by CAVEConfigure().

CAVEFree(void *p)
Frees shared memory which was allocated by CAVEMalloc().

CAVESetOption(CAVE_SHMEM_SIZE, int size)
Sets the size of the shared arena that CAVEMalloc() will use. The default is 8 MB. This must be called before CAVEConfigure().

CAVESetOption(CAVE_SHMEM_ADDRESS, int address)
Sets the base address of the shared arena that CAVEMalloc() will use. The default is 0x70000000. This must be called before CAVEConfigure().


bounce.c - trivial shared memory example


Previous page    Next page

Last modified 19 July 1997.

Dave Pape, pape@evl.uic.edu