V From:	HENRY::IN%"GKN%sdsc-sds.arpa%sri-kl.ARPA%relay.cs.net@rca.com" 15-MAR-1987 15:27 To:	STEINBERGER@sri-kl.arpa $ Subj:	Re: Processes in a RWAST state  5 	From:	 Richard Steinberger <STEINBERGER@SRI-KL.ARPA> $ 	Subject: Processes in a RWAST state" 	Date:	 Sat 14 Mar 87 10:33:01-PST  D 	... Is rebooting the only option to getting rid of a process in theE 	RWAST state?  If so, why does DEC allow VMS to create processes that  	it can't delete?   J Sigh.  This is probably one of the things that causes the most frustrationC to people who do not have extensive backgrounds into VMS internals.   H To answer your question, yes, rebooting is sometimes the only way to get  rid of a process in RWAST state.  @ [allow me to apologize in advance for the length of this one...]  M Now that that's over with... a little more information on RWAST, and resource K waits (what the RW stands for) in general.  Resource wait is an involuntary K wait state that VMS will place a process in while waiting for a resource to M become available.  This resource can usually be identified by the rest of the & name (RWxxx) displayed by SHOW SYSTEM.  H Resource waits are a subset of the scheduler state SCH$C_MWAIT, which isO shorthand for miscellaneous resource/MUTEX wait.  A MUTEX is a mutual-exclusion I semaphore, which is something VMS uses internally to protect various data J structures, such as the I/O database, logical name tables, and a few otherM odds and ends which really aren't important in this discussion.  You can tell N the difference between a MUTEX wait and a resource wait by examining the eventK flag wait mask (PCB$L_EFWM in the PCB, JPI$_EFWM) if the process' scheduler M state is SCH$C_MWAIT.  If PCB$L_EFWM is negative, then it is the system-space N address of the MUTEX which the process is attempting to gain access to.  If itL isn't, it's a small positive integer which is an indication of resource wait state the process is in.  J These are the known resource waits (as of VMS V4.x) and a little bit about what they mean:   ( 	1	RWAST	Waiting for an AST (see below).9 	2	RWMBX	Mailbox full.  A process attempted to write more 5 			data into a mailbox than the buffer quota for that  			mailbox allows.$ 	3	RWNPG	Waiting for non-paged pool.= 	4	RWPFF	Page file full.  The page file to which this process  			is assigned is full.   	5	RWPAG	Waiting for paged pool. 	6	RWBRK	$BRKTHRU wait. # 	7	RWIMG	Image activator interlock. = 	8	RWQUO	A pooled quota has been exceeded.  Use SDA to figure  			out which one. = 	9	RWLCK	Lock ID database is full? (can anybody fill me in?).  	10	RWSWP	Swap file full. : 	11	RWMPE	Waiting for the modified page write to empty the 			modified page list.@ 	12	RWMPB	Waiting for the modified page writer (to do something,4 			but I'm not sure what.  Can anybody fill me in?).A 	13	RWSCS	Waiting for a systems communications services (cluster) 	 			event. + 	14	RWCLU	Waiting for a cluster transition.   M RWAST is sort of the catch-all resource wait state.  Routines inside VMS will I place a process into RWAST hoping that the next kernel mode AST queued to L the process will have called SCH$RAVAIL to report resource avaialability for the resource in question.   O By far the most popular reason to get placed in RWAST is a lack of a non-pooled N quota, typically BYTLM, BIOLM, DIOLM or ASTLM (this is not an exhaustive list,M but you get the idea).  The BYTLM quota as it comes "out of the box" from DEC M (4096 bytes) in the default account is so pitifully small that you can't even O use DECnet effectively.  For normal users I grant a BYTLM quota of 24000 bytes.   G You can tell if this is happening by using SDA on the running system to K examine the PCB (the SDA SHOW PROCESS/INDEX=nn/PCB command) for the process L that's stuck in RWAST.  If some of the non-pooled quotas have zeroes for theI "count" portion (really, the amount remaining) then there's your problem.   J Another popular reason for processes getting stuck in RWAST is a hangup inL last-channel deassign.  You can tell if this is happening if you look at theJ process in question with SDA and see EXE$DASSGN+6D or so floating near theJ top of that process' stack (use the SDA SHOW STACK/INDEX=nnn command).  InL this case R6 points to a data structure called a CCB (channel control block)N which will generally have outstanding I/O that VMS is waiting to have completeJ before it completely deassigns the I/O channel.  If a process is stuck forK this reason you can sometimes unstick it by jostling whatever I/O device is G involved (you can figure out which by deciphering the CCB, or using the - SDA SHOW PROCESS/CHANNELS/INDEX=nnn command).   I This is not an exhaustive list of why processes get placed in RWAST, it's G just two cases I see a fair amount.  There are probably dozens of other 
 scenarios.  M Why can't you kill a process in RWAST, you ask?  Well, VMS put the process in K that state to wait for a given resource.  To delete that process before the L resource comes available could leave the system in an inconsistent state, orM cause system data structures to be corrupted.  The actual mechanics behind it N are such that the special kernel mode AST to delete the process remains queuedL until some process in VMS calls SCH$RAVAIL with the appropriate arguments toJ knock the process out of resource wait, and which time the process will be deleted.  I It is possible to break a process out of a quota related resource wait by K writing a little program to go patch the PCB and quota in question and call J SCH$RAVAIL, but it's definitely not for the novice (and probably there areK real reasons why this shouldn't be done, either, but I've successfully done  it).  L Could someone from DEC (or anyplace else, for that matter) please comment onN the interpretations of RWxxx above if I'm completely off base on some of them?? This information could really be helpful if more people had it.      gkn & -------------------------------------- Arpa:	GKN@SDSC.ARPA  Bitnet:	GKN@SDSC Span:	SDSC::GKN (5.600)  USPS:	Gerard K. Newman 	San Diego Supercomputer Center  	P.O. Box 85608  	San Diego, CA 92138 AT&T:	619.534.5076 ------- 