From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 22-MAY-1991 12:15:48.36
To:	ARISIA::EVERHART
CC:	
Subj:	was "tasking in VMS" now CONTEXT 1/2

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.97)
	 id AA24874; Wed, 22 May 91 12:00:44 EDT
Message-Id:  <9105221600.AA24874@crdgw1.ge.com>
Received: From scfb.nwc.navy.mil ([26.3.0.85]) by CRVAX.SRI.COM with TCP; Wed, 22 MAY 91 07:38:34 PDT
Date: 22 May 91 07:37:00 PDT
From: "351M::LEVINE" <levine%351m.decnet@scfb.nwc.navy.mil>
Subject: was "tasking in VMS" now CONTEXT 1/2
To: "info-vax" <info-vax@kl.sri.com>

-+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
X`09do i=1,5
X`09`09if(active(i))count=count+1
X`09enddo
X`09if(count.eq.0)then
X`09`09get_active_task=0
X`09`09return
X`09endif
X
X`09j=ifix(count*ran(ii))+1
X
X`09m=0
X`09do i=1,5
X`09`09if(active(i))then
X`09`09`09m=m+1
X`09`09`09if(m.eq.j)then
X`09`09`09`09get_active_task=i
X`09`09`09`09return
X`09`09`09endif
X`09`09endif
X`09enddo
X`09get_active_task=-1
X`09return
X`09end
X`09subroutine begin_task(i)
X
X`09implicit integer*4 (a-z)
X
X`09logical active(5)
X`09common/flags/active
X
X`09if(i.lt.1.or.i.gt.5)then
X`09`09return
X`09elseif(i.eq.1)then
X`09`09call subr_1
X`09elseif(i.eq.2)then
X`09`09call subr_2
X`09elseif(i.eq.3)then
X`09`09call subr_3
X`09elseif(i.eq.4)then
X`09`09call subr_4
X`09elseif(i.eq.5)then
X`09`09call subr_5
X`09endif
X`09active(i)=.false.
X`09return
X`09end`09`09
X`09subroutine subr_1
X
X`09implicit integer*4 (a-z)
X
X`09common/random/ii
X
X`09m=5+ifix(10.*ran(ii))
X`09write(6,100)1,m
X100`09format(' starting task ',I3,' for ',I3,' passes')
X`09do i=1,m
X`09`09call context_switch
X`09`09write(6,101)1,i,m
X101`09`09format('          continuing task ',i3,' pass ',I3,' of ',I3)
X`09enddo
X`09write(6,102)1
X102`09format('                  ending task ',i3)
X`09return
X`09end
X`09subroutine subr_2
X
X`09implicit integer*4 (a-z)
X
X`09common/random/ii
X
X`09m=5+ifix(10.*ran(ii))
X`09write(6,100)2,m
X100`09format(' starting task ',I3,' for ',I3,' passes')
X`09do i=1,m
X`09`09call context_switch
X`09`09write(6,101)2,i,m
X101`09`09format('          continuing task ',i3,' pass ',I3,' of ',I3)
X`09enddo
X`09write(6,102)2
X102`09format('                  ending task ',i3)
X`09return
X`09end
X`09subroutine subr_3
X
X`09implicit integer*4 (a-z)
X
X`09common/random/ii
X
X`09m=5+ifix(10.*ran(ii))
X`09write(6,100)3,m
X100`09format(' starting task ',I3,' for ',I3,' passes')
X`09do i=1,m
X`09`09call context_switch
X`09`09write(6,101)3,i,m
X101`09`09format('          continuing task ',i3,' pass ',I3,' of ',I3)
X`09enddo
X`09write(6,102)3
X102`09format('                  ending task ',i3)
X`09return
X`09end
X`09subroutine subr_4
X
X`09implicit integer*4 (a-z)
X
X`09common/random/ii
X
X`09m=5+ifix(10.*ran(ii))
X`09write(6,100)4,m
X100`09format(' starting task ',I3,' for ',I3,' passes')
X`09do i=1,m
X`09`09call context_switch
X`09`09write(6,101)4,i,m
X101`09`09format('          continuing task ',i3,' pass ',I3,' of ',I3)
X`09enddo
X`09write(6,102)4
X102`09format('                  ending task ',i3)
X`09return
X`09end
X`09subroutine subr_5
X
X`09implicit integer*4 (a-z)
X
X`09common/random/ii
X
X`09m=5+ifix(10.*ran(ii))
X`09write(6,100)5,m
X100`09format(' starting task ',I3,' for ',I3,' passes')
X`09do i=1,m
X`09`09call context_switch
X`09`09write(6,101)5,i,m
X101`09`09format('          continuing task ',i3,' pass ',I3,' of ',I3)
X`09enddo
X`09write(6,102)5
X102`09format('                  ending task ',i3)
X`09return
X`09end
$ CALL UNPACK TEST.FOR;10 152797771
$ v=f$verify(v)
$ EXIT


