Understand memory internals
- Last Updated: March 30, 2020
- 3 minute read
- OpenEdge
- Version 12.2
- Documentation
The primary broker process allocates shared memory for users to access data within the database. The users also use structures within memory to allow for concurrent access to information without corrupting this information. For example, two users who want to update the same portion of memory with different updates could lead to shared memory corruption. Latches prevent this corruption, similar to a lock. When a process locks a record, it is allowed to update the record without interference from other processes trying to make simultaneous changes. A latch is a lock in shared memory that allows a user to make modification to a memory block without being affected by other users.
Figure 1 shows an example of shared memory resources. This illustration should only be considered an example because it is incomplete and is not to scale. Database buffers account for more than 90 percent of shared memory, and the various latch control structures account for less than 1 percent.

As Figure 1 illustrates, there are many resources inside of shared memory. Local users
(both end-user processes and batch processes) update these structures. If two users access
this database simultaneously and both users want to make an update to the lock table
(-L), the first user requests the resource by looking into the latch
control table. If the resource is available, the user establishes a latch on the resource
using an operating system call to ensure that no other process is doing the same operation.
Once the latch is enabled, the user makes the modification to the resource and releases the
latch. If other users request the same resource, they must retry the operation until the
resource latch is available.
The database buffers are vitally important. They provide a caching area for frequently accessed portions of the database so that information can be accessed from disk once and from memory several times. Because memory is so much faster than disk, this provides an excellent performance improvement to the user when tuned properly.
The other processes shown in Figure 1 are page writers. These Asynchronous Page Writer (APW) processes write modified database buffers to disk. You can have more than one APW per database. The other writers, After-image Writer (AIW) and Before-image Writer (BIW), write after-image and before-image buffers to disk. There can only be a single BIW and a single AIW per database.
-Mn, -Mi, and -Ma, control the number
of servers a broker can start, the number of clients a server can accept, and when new servers
are started. See Manage the OpenEdge Database for details. Once
the proper server has been determined, a bi-directional link opens between that server and the
remote client. This link remains open until the user disconnects or until the broker is shut
down. 