Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ems(2) — HP-UX 5.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

memadvise(2)

memallc(2)

memchmd(2)

memlck(2)

memvary(2)

shmget(2)

shmop(2)

shmctl(2)

vsadv(2)

vson(2)

EMS(2)  —  HP-UX

Series 500 Only

NAME

ems − Extended Memory System

SYNOPSIS

#include <sys/ems.h>

NOTE

System V shared memory is an industry standard mechanism for sharing memory between processes.  When portability to other HP-UX system or other vendor’s systems is desired, use System V shared memory instead of EMS (see shmctl(2), shmget(2), and shmop(2)).

DESCRIPTION

Extended Memory System consists of system calls which allocate and deallocate address space, map files into address spaces, support shared memory, and change the protection of address spaces.  There are separate manual pages for the system calls.  This page describes features in common to all the system calls in EMS. 

Definitions

memory space
This is the actual physical memory of a machine.

address space This refers to the logical memory of a process.  Memory space is shared by having processes’ address space refer to the same memory space. 

segment A contiguous piece of address space. 

Properties of a Segment

During the allocation of a segment, the following types of segments can be requested:

MEM_SHARED
The address space is to be sharable with other processes. The data is shared across fork(2) (i.e. not copied on a fork).

MEM_PRIVATE
The address space is process local, and is copied on a fork(2). All memory segments will be either MEM_SHARED or MEM_PRIVATE; the default is MEM_PRIVATE.

MEM_CODE
The address space may, at some time in its lifetime, be made executable.

MEM_DATA The address space may, at some time in its lifetime, be read and/or written.  A segment may be MEM_CODE, MEM_DATA, or both.  The default type is derived from the initial access permissions:

MEM_R | MEM_W → MEM_DATA
MEM_X → MEM_CODE
(MEM_R | MEM_W) && MEM_X → MEM_CODE | MEM_DATA.

MEM_PAGED
Requests that a segment be created as a paged object. (This is ignored if not significant for a particular implementation).

File Mapping

EMS provides the facility for mapping a file into process address space.  This is done via memallc(2). Files can be either private or shared.

For private file mapped segments, the address space will contain an image of the file as it existed at the time of the memallc(2) call. Subsequent alterations of the file will have no effect on the contents of the address space, and vice-versa.

For shared file mapped segments, the address space is identically the file (at least the mapped portion thereof).  Changes to the address space represent changes to the file, and vice-versa.  For example, a write or read to or from the address space is, in all ways, equivalent to a file system write or read.  Similarly, re-creating (using creat(2)) the file will result in the address space containing all zeros.

The access permissions (e.g. read, write) applied to a shared mapped file are established by the first memallc(2) referencing that file. Subsequent mappings of the same file by other processes must request identical access permissions.

File mapping, as described above, is only guaranteed to apply to regular local files and block structured device files.  File mapping is not applicable to remote files at this time.  Attempting to map an unsupported file type will result in error EINVAL. 

Note that file mapping, either MEM_PRIVATE or MEM_SHARED, always requires read permission on fileid. Access modes cannot exceed those on fileid for shared, mapped files. 

Shared Memory

It is possible to share a memory space between processes.  Access to shared memory can occur in two ways.  The first way is to associate a file name as the name of the shared memory space.  Each related or unrelated process performs a memallc(2) to gain access to the shared memory through mapping the file.

Another method of sharing, without the file, is for related processes: a process can allocate a non-file-mapped shared segment; upon a fork(2), the child process will have access to the same memory space as the parent.

AUTHOR

Ems was developed by HP. 

SEE ALSO

memadvise(2), memallc(2), memchmd(2), memlck(2), memvary(2), shmget(2), shmop(2), shmctl(2), vsadv(2), vson(2),

Hewlett-Packard Company  —  Version B.1,  April 12, 1993

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026