HP3000-L Archives

February 1999, Week 2

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Gavin Scott <[log in to unmask]>
Reply To:
Gavin Scott <[log in to unmask]>
Date:
Fri, 12 Feb 1999 15:38:12 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (45 lines)
Michael writes:
> It turns out that the user is not doing a CREATE or CREATEPROCESS but is
> actualy doing a FORK().  It gets better.  If the program doing the FORK() is
> linked or is ran with the NMHEAP option, the FORK() fails.  To top it off,
> the newly created process, inherits his NMSTACK and NMHEAP (since this is
> FORK()) and therefore will always have the system default.  Sounds like an
> SR to me.

Stan already explained the odd size NMHEAP problem.  Here is an excerpt from
the Java/iX 1.1.7 release notes which talks about NMSTACK inheritance and the
POSIX fork() function:

When a process is created in the "MPE style" by calling the CREATE or
CREATEPROCESS intrinsics, the new process will have its ;NMSTACK= limit
set to the default value linked into the program file, unless it is
overridden by a CREATEPROCESS option (or the :RUN command).

When a new process is started via the POSIX fork() and exec() sequence,
the new son process inherits the NMSTACK limit of its father process.
The NMSTACK limit of the last process that was created by CREATE[PROCESS]
will affect all fork()ed descendants of that process.  To see why this
is, we have to look at what fork() and exec() do.  fork() creates a new
process that is an exact copy of the calling process, so obviously it
should and must have the same NMSTACK limit as the old process that it
is a copy of.  Once the fork() is complete, exec() is called to change
the program being executed by the process from the copy of the original
to the new program we wish to run.  Unfortunately at this point the
stack for the process has been setup (based on the copy of the original
process) and there is no opportunity to change it, even if the new
program would like to specify a different limit.

When executing program from inside the POSIX shell, the fork() and exec()
sequence is used by the shell (and most other "POSIX" type programs), which
means that the same NMSTACK limit will apply to every one of these processes.
This means that whatever ;NMSTACK= was in effect when you entered the shell
from the CI using the :RUN SH.HPBIN.SYS command (or equivalent) will apply
to everything (like Java) that you run from inside the shell.

NMHEAP works exactly the same way, except that the system default NMHEAP is
usually 80,000,000 bytes, which is generally large enough for just about
anything, and specifying a "too large" NMHEAP apparently does not have an
execution or resource penalty.

G.

ATOM RSS1 RSS2