From: heinrich@yvax.byu.edu
Newsgroups: comp.archives
Subject: [comp.os.vms] Software for resolving RWAST states available
Followup-To: comp.os.vms
Date: 30 Jul 1992 09:12:02 GMT
Organization: Brigham Young University
Distribution: world
NNTP-Posting-Host: soda.berkeley.edu
X-Original-Newsgroups: comp.os.vms
X-Original-Date: 28 Jul 92 20:03:43 -0700

Archive-name: auto/comp.os.vms/Software-for-resolving-RWAST-states-available

FREE_RSN - A utility program to get a process out of RWAST state. 

In response to some traffic I saw here recently about processes
stuck in an RWAST state, I am making available a utility I wrote a
couple of years ago called FREE_RSN.  FREE_RSN attempts to resolve a
resource shortage that may be causing a process to remain in RWAST
state.  This utility will examine a process, specified by the PID
entered at execution time, and try to determine what resource the
process is waiting on.  If the process is RWAST'd due to a depleted
process QUOTA, FREE_RSN will bump the quota in an effort to allow the
process to continue.  If the resource is a MUTEX, FREE_RSN will report
the address of the MUTEX.


FREE_RSN serves two purposes.  First, it attempts to get a process
out of a RWAST state, and avoid a possible reboot, if the resource
is a quota-related problem.  Secondly, for processes that are not 
waiting on a quota that it can bump, FREE_RSN will provide additional
information so that the system manager can take other actions to
possibly resolve the RWAST state.  


FREE_RSN specifically looks for five cases of insufficient quota:
BYTLM, DIOLM, BIOLM, ASTLM, and TQLM.  If FREE_RSN detects any of
these five quotas as being the problem, it will increment the 
appropriate fields in the JIB, PCB, and/or PHD and attempt to
reschedule the process.  NOTE:  If FREE_RSN detects that a quota
shortage is causing the process to be in a RWAST state, and after
running FREE_RSN the process is still in RWAST state, you may have
to re-execute FREE_RSN.



*********************************************************************
DISCLAIMER:

FREE_RSN is coded in Macro-32, executes in KERNEL mode, and calls
undocumented VMS scheduling routines.  As with any privileged code 
utility, there is always a chance of a system crash.  Although I
and other people have used this program several times and have not
experienced any crashes, FREE_RSN was written as a hack, not as a
PRODUCTION QUALITY utility, and may not be 100% bug free.

As FREE_RSN is being made available free of cost, neither the author
nor The LOKI Group, Inc., are responsible for any loss or damage 
that might result from use of the FREE_RSN utility.

**********************************************************************

 
Hunter Goatley, that great believer in "shareware", (and all around
nice-guy), has agreed to make FREE_RSN available from his file server.
 

To get FREE_RSN via anonymous ftp from ftp.spc.edu, you'll need the
following files:
 
        [.MACRO32]LZDCMP.EXE
        [.MACRO32.SAVESETS]FREE_RSN.BCK_Z
 
To get it via e-mail, send the following command in the body of a mail
message to FILESERV@WKUVX1.BITNET:
 
SEND FREE_RSN



Brief Overview of RWAST state:

A wait state is a VMS scheduling state, actually a queue, that a 
process is put into while it is waiting for the occurrence of an
event or the availability of a system resource.  The MWAIT state
is used when a process must wait for a depleted system resource, 
job quota, or locked mutex.  A process that is in MWAIT state has 
its PCB inserted on the MWAIT queue, located at SCH$GQ_MWAIT.  (There
is no distinction made between resident and outswapped processes in
the MWAIT queue).  The PCB field PCB$L_EFWM contains the entity that
the process is waiting for.  If the process is waiting on a MUTEX,
then PCB$L_EFWM contains the address of the mutex.  If the process
is waiting for a pooled job quota, then PCB$L_EFWM contains the
address of the JIB for the process.  If the process is waiting on
a system resource, then PCB$L_EFWM contains the symbolic value of
the resource being waited on, defined in the $RSNDEF macro in LIB.MLB.
The system global longword, SCH$GL_RESMASK, has a bit set for each
system resource that a process in the MWAIT queue is waiting on.
The process exits the MWAIT state and becomes computable when an
executive routine declares the resource it was waiting on to be
available.

A process is placed in the RWAST scheduling state when it is waiting
on a resource that is expected to be satisfied by the queuing or 
delivery of an AST to the process.  Unlike the other wait states,
there is no one specific resource that corresponds to the RSN$_ASTWAIT
symbolic name.  


Note that FREE_RSN does not deal with ALL MWAIT cases, only those that
can be resolved by adjusting process specific parameters.


*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*
Ed Heinrich
The LOKI Group, Inc.
HEINRICH@yvax.byu.EDU
*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*+*