Problem
On occasion, programs run on a Pentium Pro system with two or more processors terminate unexpectedly with "Segmentation Violation" (SIGSEGV).
Cause
One possible cause is that two or more processes that share page tables in memory incur a page fault on the same page table entry. Due to a problem in handling page faults on the Pentium Pro in this situation, it is possible for a spurious SIGSEGV to be sent to the processes involved.
Such a situation can occur, for instance, if multiple instances
of a small COFF program are run concurrently. COFF executables
employ sharing of page tables (in order to share actual pages of
memory wherever possible) when multiple instances of the executable
are run. Therefore, in a small program (with just a few pages
of memory when run), the chances of different CPUs faulting on the
same page table entry can be high, either because the pages have
been swapped out after awhile, or because the pages need to be
demand-paged in at the start of execution.The above situation is fairly rare, since most processes occupy
more than a few pages of memory. However, SCO Open Server 3.0
and SCO UNIX Version 4.2 systems are more vulnerable than SCO
OpenServer 5 systems, since most programs in SCO Open Server 3.0
are COFF executables. In SCO OpenServer 5 systems, the vast
majority of programs are ELF executables, which usually do not
share page tables when run.Another, perhaps more substantial example, is shared memory.
Both COFF and ELF executables that attach to shared memory
segments will share page tables. If a page of shared memory is
faulted on (if it happens to be swapped out) simultaneously
by two processes, then a spurious SIGSEGV can occur. Many
commercial applications that employ shared memory, such as
database applications, guard against excessive paging and swapping,
which, perhaps inadvertently, prevents these spurious SIGSEGVs
from occurring. Solution
If you suspect it is a problem on your Pentium Pro MP system, then try to find out whether any of the following apply; both situations present greater vulnerability to the problem if the system has some memory shortage and exhibits some paging/swapping activity:
(1) multiple instances of a very small COFF program running concurrently
(2) frequent access of a region of shared memory (again, smaller segments present greater vulnerability)
The best way to work around (1) on SCO OpenServer 5 is to recompile
the program and create an ELF executable. The only workaround on
SCO Open Server 3.0 is to lessen the concurrency of running the
programs.The best way to work around (2) is to use the SHM_LOCK option to shmctl(S), before performing other operations on the shared memory segment. This particular option, which can only be exercised by root, locks the shared memory segment in memory.