2. Shared Memory Management
All web application developers grapple with the question of how to maintain state
between page views. Many paradigms exist for the passing of small name value pairs
from page to page via the query string or HTML Form submissions. But often times
one must maintain complex data over multiple page views, such as the contents
of a shopping cart, or changes to a Personal Homepage.
The best way to maintain such data is in objects.
Mantaining objects in memory between page views is problematic for Apache
modules on Unix since each page view may be handled by a different process.
Processes, unlike threads, each have their own memory and are prohibited
from reading from or writing to each others memory.
Moto solves this problem by providing developers with a shared memory manager.
At Apache startup the parent Apache process initializes a shared memory segment
and gives each child process rights to it as they are spawned. APIs
are provided for malloc, calloc, realloc, and free replacement functions which work
against this shared memory segment. All of the included codex libraries are
compiled against these APIs.
This memory manager provides a number of other important features including:
- Thread (process) safety
- Numerous debugging and diagnostic functions
- An included Garbage Collector
It is open source and may be used on other open source
projects. Check out the code in the moto distribution in
Copyright © 2000 - 2003 David Hakim