From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 16-JAN-1991 11:00:46.28
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	infinite cpu time on VAXstations

Received:  by crdgw1.ge.com (5.57/GE 1.80)
	 id AA17489; Wed, 16 Jan 91 10:29:17 EST
Received: From CUNYVM.CUNY.EDU by CRVAX.SRI.COM with TCP; Wed, 16 JAN 91 07:19:14 PST
Received: from HEARN.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.2.2MX) with BSMTP id 2152; Wed, 16 Jan 91 10:10:25 EST
X-Delivery-Notice:  SMTP MAIL FROM does not correspond to sender.
Received: from KUB.NL (S211KENO) by HEARN.BITNET (Mailer R2.07) with BSMTP id
 2392; Wed, 16 Jan 91 16:10:13 MET
Date: Wed, 16 Jan 91 16:08 N
From: Kees Noyens - KUB/DRC <S211KENO%KUB.NL@CUNYVM.CUNY.EDU>
Subject: infinite cpu time on VAXstations
To: info-vax@kl.sri.com
Message-Id: <D32B1FD7C0BF4002BE@KUB.NL>
X-Envelope-To: info-vax@kl.sri.com
X-Vms-To: IN%"info-vax@kl.sri.com"
Comments: This message was sent with PMDF 3.1

MCKEEVER@VAX2.CSTP.UMKC.EDU asks how to give users infinite cpu time
on workstations, and at the same time maintain their limited cpu time
on other nodes. This can be a bit complicated in a cluster with one UAF !

I've solved it the following way:

o write a program that changes the cpulimit
o install this program with CMKRNL privilege, ONLY on the VAXstations
o call the program from SYLOGIN (only on VAXstations) and DECW$SYLOGIN
o also, make the WSAx process less CPU consumptive:
  edit decw$system_defaults:decw$login.dat and add the line:
*blinkRate:<some large integer>

  I don't know what the largest value <integer> can be, but never give
  it the value 0; it kills DECwindows ! The blinking cursor uses CPU time !

  edit decw$system_defaults:decw$session.dat and add:
*blinkRate:0 ! zero is ok here, this is to disable the cursor blinking
             ! in the pause session window.


The program looks like:

C               Compile and link :
C               $ FORTRAN CPULIM
C               $ MACRO PUT_CPULIM+SYS$LIBRARY:LIB.MLB/LIB
C               $ LINK CPULIM,PUT_CPULIM,SYS$SYSTEM:SYS.STB/SELECT/NOTRACEBACK
C
C               The procedure assumes the existence of
C               a dcl-symbol "adjusted_cputim", which contains the new
C               CPU-limit in units of 10 milli-seconds
C
        INTEGER*4       LIMIT
        CHARACTER*8     C
        INCLUDE '($SSDEF)'
        IF  (LIB$GET_SYMBOL('ADJUSTED_CPUTIM',C) .EQ. SS$_NORMAL) THEN
                 READ (UNIT=C(1:8),FMT='(BN,I8)') LIMIT
                 CALL PUT_CPULIM(LIMIT)
        END IF
        END

-------------------------------

        $IPLDEF
        $PCBDEF
        $PHDDEF
;
; This routine places the CPULIM quota into the Process header.
; On entry the stack contains the following:
; 00(AP) - Argument count
; 04(AP) - New CPU limit address
;---
STORE:  .LONG           0
        .ENTRY          PUT_CPULIM,^M<>
        CMPL            #1,00(AP)
        BNEQ            10$
        MOVL            @04(AP),STORE
10$:    $CMKRNL_S       ROUTIN  = KM_RTN_1
        RET
;+++
; Kernel mode coding
; On entry R4 contains the new CPU limit.
;---
        .ENTRY          KM_RTN_1,^M<R2,R3,R4>
        MOVL            STORE,R4
        SETIPL          #IPL$_ASTDEL
        MOVL            G^CTL$GL_PCB,R2
        MOVL            PCB$L_PHD(R2),R3
        MOVL            R4,PHD$L_CPULIM(R3)
        SETIPL          #0
        RET
        .END

---------------------------------------------------------------

Kees Noyens
Computing Centre Tilburg University
The Netherlands

Surfnet : KUBVX1::S211KENO
Bitnet  : S211KENO@HTIKUB5.BITNET
Internet: S211KENO%HTIKUB5.BITNET@CUNYVM.CUNY.EDU

