Sys V handling of insufficient swap space.

pingel at wang7.UUCP pingel at wang7.UUCP
Thu Feb 26 04:14:16 AEST 1987


How many Sys V ports cleanly deal with lack of swap space?
What is the typical method of dealing with this?  Is there an
"accepted" response.  Or do most systems simply terminate processes
to prevent crashing.

  Example code as follows will bring out this bug.  It's so simple that
  anyone could produce it from scratch.  Please NO FLAMES for posting 
  this code, as any user could code his own.

  Any unprivileged user can hang SYS V.2.2 by compiling and
  executing enough instances of the following simple program. This
  can be achieved by continuously issue "hangu&" until the os hangs.

  The operator's console will leave the following message when
  this happens:
  DANGER: Out of swap space
    needed 30 pages.

  The source of "hangu" is as follows:

/**********************************************************************
 *
 * Each instance of this program will require roughly 10 mega byte
 * paging space.
 *
 *   SYS V.2.2 will hang after running out of disk paging space.
 *
 *   Allocate a large memory array and update each element.
 *
 */
#define MAXSIZE  2621440
#define ITERATIONS 100

main()
{
register int inner,outer;
long array[MAXSIZE];

	for (outer=0; outer < ITERATIONS; outer++) {
		for (inner=0; inner<MAXSIZE; inner+=8) {
			array[inner] = inner * outer;
		}
	}
return(0);
}
---------------------------------------------------------------------------
-- 
Lee Pingel, M/S 014790			  harvard!vaxine!ima--+
Wang Laboratories Inc.			decvax!wanginst!wang--+---wang7!pingel
1 Industrial Ave.			  appollo!vaxine!ima--+
Lowell, MA 01851                            harvard!masscomp--+



More information about the Comp.unix.wizards mailing list