Table of Contents

DMKSCH Source

References

Source Listing

DMKSCH.ASSEMBLE.txt
  1. SCH TITLE 'DMKSCH (CP) VM/370 - RELEASE 6' 00001000
  2. ISEQ 73,80 00002000
  3. *. 00003000
  4. * MODULE NAME - 00004000
  5. * 00005000
  6. * DMKSCH 00006000
  7. * 00007000
  8. * FUNCTION - 00008000
  9. * 00009000
  10. * TO MAINTAIN QUEUES OF RUNNABLE AND ELIGIBLE USERS, TO ALTER 00010000
  11. * USERS DISPATCHING STATUS, AND TO PERIODICALLY RECALCULATE 00011000
  12. * USERS WORKING SET AND DISPATCHING PRIORITY, AND TO MAINTAIN 00012000
  13. * STATISTICS ON UTILIZATION AND CONTENTION FOR MAJOR RESOURCES 00013000
  14. * 00014000
  15. * DMKSCH ALSO CONTAINS THE ROUTINES THAT MAINTAIN THE SYSTEM TOD 00015000
  16. * CLOCK COMPARATOR REQUEST QUEUE AND THE CODE THAT MONITORS FAV- 00016000
  17. * ORED EXECUTION USERS 00017000
  18. * 00018000
  19. * ATTRIBUTES - 00019000
  20. * 00020000
  21. * SERIALLY REUSABLE, RESIDENT, CALLED VIA BALR 00021000
  22. * 00022000
  23. * ENTRY POINTS - 00023000
  24. * 00024000
  25. * DMKSCHDL - ALTER A USER'S DISPATCHING STATUS 00025000
  26. * DMKSCHST - ESTABLISH A CLOCK COMPARATOR INTERRUPT REQUEST 00026000
  27. * DMKSCHRT - RESET A CLOCK COMPARATOR INTERRUPT REQUEST 00027000
  28. * DMKSCHAE - INTERRUPT ENTRY POINT WHEN FAVORED EXECUTION 00028000
  29. * MEASUREMENT INTERVAL EXPIRES 00029000
  30. * DMKSCH80 - INTERRUPT ENTRY POINT FOR "REAL" LOCATION 80 TIMER 00030000
  31. * DMKSCHCP - INTERRUPT ENTRY POINT FOR "REAL" CPU TIMER 00031000
  32. * DMKSCHMD - INTERRUPT ENTRY POINT FOR MIDNITE DATE CHANGE 00032000
  33. * DMKSCHTI - TIMER INTERRRUPT TO UPDATE CPU UTILIZATION 00033000
  34. * 00034000
  35. * ENTRY POINTS - NON-EXECUTABLE 00035000
  36. * 00036000
  37. * DMKSCHN1 - CURRENT NUMBER OF USERS IN Q1 (INTERACTIVE) 00037000
  38. * DMKSCHN2 - CURRENT NUMBER OF USERS IN Q2 (NON-INTERACTIVE) 00038000
  39. * DMKSCHQ1 - Q1 TIME SLICE 00039000
  40. * DMKSCHQ2 - Q2 TIME SLICE 00040000
  41. * DMKSCHRL - ANCHOR FOR LIST OF DISPATCHABLE USERS 00041000
  42. * DMKSCHTQ - ANCHOR FOR LIST OF OUTSTANDING CLOCK COMPARATOR 00042000
  43. * INTERRUPT REQUESTS 00043000
  44. * DMKSCHPG - DESIRABLE PAGING OVERHEAD PERCENTAGE (<=99) 00044000
  45. * DMKSCHAP - ASSURED EXECUTION PERCENTAGE FOR CURRENT FAVORED 00045000
  46. * EXECUTION USER 00046000
  47. * DMKSCHAU - POINTER TO VMBLOK OF FAVORED USER 00047000
  48. * DMKSCHCU - SMOOTHED CPU UTILIZATION FIELD 00048000
  49. * DMKSCHCA - SMOOTHED APU UTILIZATION FIELD 00048100
  50. * DMKSCHS1 - SMOOTHED Q1 VALUE 00049000
  51. * DMKSCHS2 - SMOOTHED Q2 VALUE 00050000
  52. * DMKSCHCO - SMOOTHED CORE UTILIZATION FIELD 00051000
  53. * DMKSCHSC - SCHEDULER CONTENTION RATIO FIELD 00052000
  54. * DMKSCHLI - WAIT TIME SAMPLING INTERVAL 00053000
  55. * 00054000
  56. * ENTRY CONDITIONS - 00055000
  57. * 00056000
  58. * FOR DMKSCHDL - 00057000
  59. * GPR11 = ADDRESS OF VMBLOK FOR CURRENT USER 00058000
  60. * GPR15 = ADDRESS OF DMKSCHDL 00059000
  61. * 00060000
  62. * FOR DMKSCHST - 00061000
  63. * GPR1 = ADDRESS OF TRQBLOK FOR REQUESTED TIMER INTERRUPT 00062000
  64. * GPR11 = ADDRESS OF CURRENT USER 00063000
  65. * GPR15 = ADDRESS OF DMKSCHST 00064000
  66. * 00065000
  67. * FOR DMKSCHRT - SAME AS DMKSCHST 00066000
  68. * 00067000
  69. * FOR OTHER ENTRY POINTS - 00068000
  70. * GPR10 = ADDRESS OF TRQBLOK FOR INTERRUPT 00069000
  71. * GPR11 = ADDRESS OF VMBLOK OF INTERRUPTS OWNER 00070000
  72. * GPR15 = ADDRESS OF INTERRUPT ENTRY POINT 00071000
  73. * 00072000
  74. * EXIT CONDITIONS - 00073000
  75. * 00074000
  76. * NONE 00075000
  77. * 00076000
  78. * CALLS TO OTHER ROUTINES - 00077000
  79. * 00078000
  80. * DMKMIDNT - CALLED TO ALTER DATE AT MIDNIGHT 00079000
  81. * DMKFRET - TO RELEASE STORAGE 00080000
  82. * DMKQCNWT - TO WRITE OVERLOAD DIAGNOSTICS TO OPERATOR. 00081000
  83. * DMKPTRRS COUNT REF. PAGES AND ADD TO FLUSH LIST 00081100
  84. * DMKLOKSP - TO OBTAIN SPIN LOCKS 00081200
  85. * 00082000
  86. * EXTERNAL REFERENCES - 00083000
  87. * 00084000
  88. * DMKPTRFL - ADDRESS OF FLUSHED PAGE LIST 00085000
  89. * DMKPTRU1 - ADDRESS OF USER PAGE LIST 00086000
  90. * DMKDSPNP - NUMBER OF DYNAMICALLY ASSIGNABLE PAGE FRAMES 00087000
  91. * DMKPTRRL - HIGH WATER LIMIT FOR RESERVED PAGE USER 00088000
  92. * DMKLOKTR - TIMER REQUEST QUEUE LOCK 00088100
  93. * DMKLOKDS - DISPATCHER QUEUES LOCK 00088200
  94. * DMKLOKRL - RUNLIST LOCK 00088300
  95. * 00089000
  96. * TABLES/WORKAREAS - 00090000
  97. * 00091000
  98. * TRQBLOK,TEMPSAVE 00092000
  99. * 00093000
  100. * REGISTER USAGE - 00094000
  101. * 00095000
  102. * GPR0-9 - TIMER ARITHMETIC AND PRIORITY CALCULATIONS 00096000
  103. * GPR10 - TRQBLOK BASE 00097000
  104. * GPR11 - VMBLOK BASE 00098000
  105. * GPR12 - DMKSCH BASE 00099000
  106. * GPR13 - DMKSCH BASE 00099100
  107. * GPR14 - INTERNAL LINKAGE 00100000
  108. * GPR15 - ADDRESSABILITY FOR QUEUE CONTROL DSECT 00101000
  109. * 00102000
  110. * NOTES - 00103000
  111. * 00104000
  112. * NONE 00105000
  113. * 00106000
  114. * OPERATION - 00107000
  115. * 00108000
  116. * A. MAIN STATUS CHANGE MAINTENANCE 00109000
  117. * 1. STAMP/UNSTAMP USER'S "REAL" TIMER(S) 00110000
  118. * 2. IF USER IS RUNNABLE, SKIP TO STEP 6. 00111000
  119. * 3. IF USER WAS RUNNABLE BEFORE, MARK NOT RUNNABLE 00112100
  120. * IF IN ELIGIBLE LIST DROP FROM LIST. 00112200
  121. * 4. IF USER IS IN AN IDLE WAIT STATE, DROP FROM Q 00113000
  122. * 5. GO TO SECTION B TO LOOK FOR ELIGIBLE USERS TO ADD TO Q 00114000
  123. * 6. IF USER IS RUNNABLE, MARK IT RUNNABLE. 00115100
  124. * 7. IF USER WAS RUNNABLE BUT NOT IN Q BEFORE, GO TO SECTION 00116000
  125. * B TO LOOK FOR USERS TO ADD TO Q 00117000
  126. * 8. IF USER WAS NOT RUNNABLE BEFORE, ADD TO APPROPRIATE RUN- 00118000
  127. * NABLE LIST 00119000
  128. * 9. IF USER'S TIME SLICE HAS BEEN EXCEEDED, DROP FROM Q 00120000
  129. * 10. IF USER HAS GONE COMPUTE BOUND, DROP TO LOW PRIORITY 00121000
  130. * 11. GO TO SECTION B 00122000
  131. *. 00123000
  132. EJECT 00124000
  133. COPY OPTIONS 00125000
  134. COPY LOCAL OPTIONS 00126000
  135. EJECT 00127000
  136. DMKSCH CSECT 00128000
  137. SPACE 00129000
  138. EXTRN DMKPTRRS 00130000
  139. EXTRN DMKPTRU1 00131000
  140. EXTRN DMKDSPNP 00132000
  141. EXTRN DMKCVTBH 00133000
  142. EXTRN DMKMIDNT 00134000
  143. EXTRN DMKPTRRL 00135000
  144. EXTRN DMKQCNWT @V2B2638 00136000
  145. EXTRN DMKCVTAB @VA04301 00136100
  146. EXTRN DMKPTRUC @VA07810 00136200
  147. SPACE 00137000
  148. ENTRY DMKSCHTI,DMKSCHCU,DMKSCHCO,DMKSCHSC @V2B2638 00138000
  149. ENTRY DMKSCHS1,DMKSCHS2,DMKSCHLI @V2B2638 00139000
  150. ENTRY DMKSCHDL 00140000
  151. ENTRY DMKSCHST 00141000
  152. ENTRY DMKSCHRT 00142000
  153. ENTRY DMKSCHN1 00143000
  154. ENTRY DMKSCHN2 00144000
  155. ENTRY DMKSCHAP 00145000
  156. ENTRY DMKSCHTQ 00146000
  157. ENTRY DMKSCHRL 00147000
  158. ENTRY DMKSCHPG 00148000
  159. ENTRY DMKSCHQ1 00149000
  160. ENTRY DMKSCHQ2 00150000
  161. ENTRY DMKSCHAU 00151000
  162. ENTRY DMKSCHAE @VA04341 00151100
  163. ENTRY DMKSCHMD 00152000
  164. ENTRY DMKSCHW1,DMKSCHW2,DMKSCHAL 00153000
  165. ENTRY DMKSCHEL @V305535 00154000
  166. ENTRY DMKSCHBK @VA05288 00154100
  167. ENTRY DMKSCHCA @V407577 00154200
  168. SPACE 00155000
  169. AIF (&RTIMR EQ 0).RTM3 00156000
  170. ENTRY DMKSCH80 00157000
  171. ENTRY DMKSCHCP 00158000
  172. .RTM3 ANOP 00159000
  173. SPACE 00160000
  174. SPACE 00161000
  175. USING PSA,R0 00162000
  176. USING VMBLOK,R11 00163000
  177. SPACE 2 00164000
  178. DMKSCHDL EQU * 00165000
  179. STM R0,R15,BALRSAVE SAVE CALLER'S REGISTERS 00166000
  180. LR R12,R15 ESTABLISH 00167000
  181. LA R13,2048(,R12) @V407577 00168100
  182. LA R13,2048(,R13) @V407577 00168200
  183. USING DMKSCHDL,R12,R13 @V407577 00168300
  184. L R0,DMKSCHCT GET TOTAL CALL COUNT 00169000
  185. AL R0,F1 BUMP 00170000
  186. ST R0,DMKSCHCT AND SAVE 00171000
  187. AIF (NOT &TRACE(9)).TR1 00174000
  188. TM TRACFLG1,TRAC08 TRACING ACTIVE? 00175000
  189. BZ NOTRAC1 BRANCH IF NOT 00176000
  190. TRACE CODE=TRCSCH,R15,R1,R2 @V407577 00177100
  191. STCM R11,B'0111',1(R15) SAVE USERS VMBLOK @V407577 00177200
  192. L R1,VMRSTAT SAVE USER STATUS BYTES @VA01166 00180000
  193. ST R1,4(,R15) IN TRACE TABLE @VA01166 00181000
  194. LH R1,VMIOINT SAVE I/O INT PENDING FLAGS @VM03123 00182000
  195. ICM R1,B'0100',VMTLEVEL GET USER TIMER LEVEL @VM03123 00183000
  196. ICM R1,B'1000',VMQLEVEL GET USER QUEUE LEVEL @VM03123 00184000
  197. ST R1,8(,R15) IN THE TRACE TABLE @VA01166 00185000
  198. LR R1,R14 GET RETURN ADDRESS @VM03123 00186000
  199. ICM R1,B'1000',VMPEND AND INT. PENDING SUMMARY @VM03123 00187000
  200. ST R1,12(R15) IN THE TRACE TABLE @VM08543 00188000
  201. NOTRAC1 EQU * 00194000
  202. .TR1 ANOP 00195000
  203. AIF (&RTIMR EQ 0).RTM1 00196000
  204. TM VMTLEVEL,VMRON REAL TIMER RUNNING ?? 00197000
  205. BNZ CKCPWAIT @VA01688 00198000
  206. TM VMPSTAT,VMV370R IS THIS EC MODE @VA01688 00199000
  207. BZ CKRSTAT NO, NO CPU TIMER VALUE @VA01688 00200000
  208. CKCPWAIT EQU * @VA01688 00201000
  209. TM VMRSTAT,VMCPWAIT IN PSEUDO- WAIT ?? 00202000
  210. BNZ UNSTAMP YES -- TIMER MUST NOT RUN 00203000
  211. TM VMRSTAT,VMPSWAIT IN USER WAIT ?? 00204000
  212. BZ UNSTAMP NO -- TIMER MUST NOT RUN 00205000
  213. TM VMTLEVEL,VMSTMPI+VMSTMPT TIMER REQUESTS QUEUED ? 00206000
  214. BO CKRSTAT YES, BOTH TIMERS STAMPED @VA01688 00207000
  215. BAL R3,RSTMPON NO -- GO START IT 00208000
  216. B CKRSTAT -- 00209000
  217. SPACE 00210000
  218. UNSTAMP TM VMTLEVEL,VMSTMPI+VMSTMPT TIMER REQUESTS QUEUED? 00211000
  219. BZ CKRSTAT NO -- CONTINUE 00212000
  220. BAL R3,RSTMPOFF YES -- GO STOP IT 00213000
  221. SPACE 00214000
  222. CKRSTAT EQU * 00215000
  223. .RTM1 ANOP 00216000
  224. TM VMRSTAT,VMNORUN+VMIDLE IS THIS MACHINE RUNNABLE @VA06404 00217000
  225. BZ CKRUN YES -- 00218000
  226. TM VMDSTAT,VMRUN+VMINQ WAS HE RUNNABLE OR IN Q BEFORE?? 00218100
  227. BZ SCHEXIT NO - NO STATUS CHG @V408246 00218200
  228. BO RESETRUN INDICATE NOT RUNNABLE @V408246 00218300
  229. SPACE 1 00231000
  230. SPACE 00232000
  231. CKIDLE TM VMDSTAT,VMINQ IN A QUEUE @VA04341 00233400
  232. BZ DROPL DROP FROM ELIGBLE LIST @V408246 00233800
  233. TM VMRSTAT,VMLONGWT IN A LONG WAIT @VA04341 00234200
  234. BNZ DROPHIM YES - DROP USER FROM QUEUE @VA04341 00234600
  235. TM VMDSTAT,VMQSEND EXPIRED TIME SLICE @VA04341 00235000
  236. BZ SCHEXIT NO - RETURN TO CALLER @VA04341 00235400
  237. DROPHIM BAL R14,DROPLIST DROP FROM LIST @V408246 00235800
  238. BAL R14,DROPQ DROP FROM QUEUE @V408246 00235900
  239. B CKWAITNG SEE IF ANY USERS WAITING @VA04341 00236200
  240. DROPL TM VMDSTAT,VMELIG IN ELIGIBLE LIST ?? @V408246 00236300
  241. BZ SCHEXIT EXIT IF NO @V408246 00236400
  242. BAL R14,DROPLIST DROP FROM LIST IF YES @V408246 00236500
  243. B SCHEXIT RETURN TO CALLER @V408246 00236600
  244. RESETRUN NI VMDSTAT,X'FF'-VMRUN NOT DISPATCHABLE @V408246 00236700
  245. B CKIDLE CHECK FOR IDLE @V408246 00236800
  246. SPACE 00244000
  247. ENTRY DMKSCHCT 00245000
  248. DMKSCHCT DC F'0' COUNT TOTAL CALLS TO DMKSCH 00246000
  249. EJECT 00247000
  250. CKRUN EQU * HERE TO CHECK OUT RUNNABLE USER -- 00248000
  251. TM VMQSTAT,VMPRIDSP SHOULD USER BE SCHEDULED FOR Q1 ?? 00249000
  252. BZ CKDSTAT NO -- 00250000
  253. NI VMQSTAT,X'FF'-VMPRIDSP REMOVE PRIORITY FLAG @VA01354 00251000
  254. SLR R1,R1 CLEAR @VA01354 00252000
  255. STH R1,VMQPRIOR USER DISPATCHING PRIORITY @VA01354 00253000
  256. TM VMDSTAT,VMINQ CURRENTLY IN A QUEUE ? @VA04341 00256000
  257. BO CKDSTAT IF YES - RE-ADD TO RUNLIST @VA04341 00257000
  258. TM VMQLEVEL,VMQ1 ALREADY SET FOR Q1 ?? @VA07752 00257100
  259. BO AWAITING YES, EASY AS PIE @VA07752 00257200
  260. TM VMDSTAT,VMELIG NOT Q1, IN Q2 ELIGIBLE ?? @VA07752 00257300
  261. BZ CKRUN1 NO, FLAG FOR Q1 ENTRY @VA07752 00257400
  262. BAL R14,DROPLIST DROP Q2 ELIG. THEN ADD TO Q1 @VA07752 00257500
  263. CKRUN1 EQU * NOT IN Q2 ELIGIBLE, ADD TO Q1 @VA07752 00257600
  264. OI VMQLEVEL,VMQ1 FLAG FOR QUEUE 1 ENTRY @VA04341 00258000
  265. B AWAITING ADD USER TO ELIGIBLE LIST @VA04341 00259000
  266. SPACE 00266000
  267. CKDSTAT TM VMDSTAT,VMRUN+VMINQ WAS USER RUNNABLE OR IN A Q BEFORE 00267000
  268. BO CKTIME YES -- GO TEST FOR TIME SLICE END 00268000
  269. TM VMDSTAT,VMINQ IS USER IN QUEUE @V408246 00269200
  270. BZ AWAITING ADD TO ELIG LIST IF NOT @V408246 00269300
  271. OI VMDSTAT,VMRUN MARK DISPATCHABLE @V408246 00269400
  272. NI VMQLEVEL,255-VMCOMP RESET COMPUTE BOUND @VA12052 00269500
  273. B CKTIME NOW TEST TIME SLICE END @VA04341 00269600
  274. SPACE 1 00269800
  275. AWAITING TM VMQLEVEL,VMAEX+VMAEXP IS THIS A SPECIAL USER @VA04341 00270000
  276. BNZ QAEX YES - ADD TO QUEUE IMMEDIATELY @VA04341 00270200
  277. BAL R14,AWAITLST RUNNABLE AND NOT IN A QUEUE - @VA04341 00270400
  278. * ADD TO ELIGIBLE LIST 00270600
  279. B CKWAITNG LOOK FOR USER TO ADD TO QUEUE @VA04341 00270800
  280. SPACE 00273000
  281. CKTIME EQU * RUNNABLE AND IN A Q - TEST FOR TIME SLICE END 00274000
  282. TM VMDSTAT,VMQSEND TIME SLICE END @VA04341 00274100
  283. BO TMRDROP YES - DROP FROM QUEUE @VA04341 00274200
  284. TM VMDSTAT,VMTSEND TIME SLICE END ?? 00275000
  285. BZ SCHEXIT NO - RETURN TO CALLER @VA04341 00276100
  286. NI VMDSTAT,X'FF'-VMTSEND UNFLAG T.S. END 00277000
  287. TM VMQLEVEL,VMCOMP ALREADY MARKED COMPUTE BOUND ?? 00278000
  288. BZ *+8 NO .. GO FLAG 1ST TIME SLICE END 00279000
  289. OI VMQLEVEL,VMLOPRI FLAG 2ND AND SUBSEQUENT SLICE ENDS 00280000
  290. OI VMQLEVEL,VMCOMP .... 00281000
  291. BAL R14,DROPLIST REMOVE FROM CURRENT LIST POSITION 00282000
  292. CHARGE SYNC UPDATE VMTTIME @V4M0203 00282100
  293. BAL R14,CALCPRI RE-CALCULATE DISPATCHING PRIORITY @V407577 00283100
  294. BAL R14,ARUNLST RE-ADD TO RUNLIST @VA04341 00284500
  295. B SCHEXIT AND RETURN TO CALLER @VA04341 00285000
  296. SPACE 00288000
  297. EJECT 00290000
  298. TMRDROP BAL R14,DROPQ DROP USER FROM ACTIVE QUEUE @VA04341 00291000
  299. BAL R14,DROPLIST ALSO FROM DISPATCHABLE LIST @VA04341 00292000
  300. NI VMQLEVEL,X'FF'-VMHIPRI PERCENTAGE ACHIEVED @VA04341 00293000
  301. TM VMQLEVEL,VMAEX ASSURED EXECUTION USER @VA04341 00294000
  302. BZ AWAITING NO - ADD TO ELIGIBLE LIST @VA04341 00295000
  303. B NODROP ADD USER BACK IN EXECUTABLE LIST @V4M0215 00296100
  304. QAEX TM VMQLEVEL,VMAEXP FAVORED PERCENTAGE USER @VA04341 00297000
  305. BZ QAEXLOW NO @VA04341 00298000
  306. OI VMQLEVEL,VMHIPRI YES - HE GETS TOP PRIORITY @VA04341 00299000
  307. QAEXLOW DS 0H @V4M0215 00300100
  308. TM VMDSTAT,VMELIG IS USER IN ELIGIBLE LIST? @V4M0215 00300200
  309. BZ NODROP NO, NO NEED TO CALL DROPLIST @V4M0215 00300300
  310. BAL R14,DROPLIST DROP FROM ELIGIBLE LIST @V4M0215 00300400
  311. NODROP DS 0H @V4M0215 00300500
  312. BAL R14,ADDQ ADD TO ACTIVE QUEUE @VA04341 00301000
  313. BAL R14,CALCBIAS CALC ELIGIBLE PRIORITY @V407577 00302100
  314. ST R0,VMEPRIOR STORE FOR 'VMRPRIOR' CALC @VA04341 00303000
  315. BAL R14,ARUNLST AND THE RUNNABLE LIST @VA04341 00304000
  316. * QUEUE ADD 00306000
  317. B CKWAITNG LOOK FOR MORE USERS TO ADD TO @VA04341 00307000
  318. * QUEUE 00308000
  319. EJECT 00340000
  320. *. 00341000
  321. * OPERATION - 00342000
  322. * 00343000
  323. * B. ADD USERS TO DISPATCHABLE LIST 00344000
  324. * 00345000
  325. * 1. ADD ANY USERS WAITING FOR Q1 TO RUNNABLE LIST, FIRST SUB- 00346000
  326. * TRACTING THEIR PROJECTED WORKING SETS FROM THE TOTAL NUMBER 00347000
  327. * OF PAGE FRAMES AVAILABLE 00348000
  328. * 2. LOCATE THE FIRST USER WAITING FOR Q2 AND SUBTRACT HIS PROJ- 00349000
  329. * ECTED WORKING SET FROM THE NUMBER OF PAGES AVAILABLE; IF HE 00350000
  330. * FITS ADD HIM TO THE DISPATCHABLE LIST AND CONTINUE WITH THE 00351000
  331. * NEXT WAITING USER 00352000
  332. * 3. IF THE USER'S WORKING SET WILL EXCEED THE NUMBER OF AVAIL- 00353000
  333. * ABLE PAGE FRAMES, FIRST INSURE THAT HIS PROJECTED WORKING 00354000
  334. * SET DOES NOT EXCEED ALL OF DYNAMIC STORAGE; THEN, TEST TO 00355000
  335. * SEE THAT THERE IS AT LEAST ONE Q2 (NON-INTERACTIVE) USER. 00356000
  336. * IF THERE ARE NONE, ADD THIS USER TO Q2. 00357000
  337. * 4. AFTER Q2 HAS BEEN FILLED OR ALL RUNNABLE USERS HAVE BEEN 00358000
  338. * PROCESSED, TEST TO SEE IF THE CURRENT USER HAS BEEN DROPPED 00359000
  339. * FROM Q; IF HE HAS, PLACE THE CORTABLE ENTRIES FOR HIS 00360000
  340. * ACTIVE PAGE FRAMES ON THE FLUSHED PAGE LIST 00361000
  341. * INSURE THAT USER'S PROJECTED WORKING SET IS LESS THAN 00361100
  342. * THE NUMBER OF REFERENCED PAGES. ADJUST IF REQUIRED. 00361200
  343. * 00362000
  344. *. 00363000
  345. SPACE 2 00364000
  346. CKWAITNG EQU * LOOK FOR RUNNABLE USERS TO ADD TO ACTIVE QUEUES 00365000
  347. SPACE 00366000
  348. CHARGE STOP NO CHARGE FOR QUEUE MANIPULATION @V407577 00367100
  349. L R5,WAITQ1 GET ELIGLIBE LIST 00368000
  350. LA R6,WAITQ1 GET ADDRESS OF LIST ANCHOR 00369000
  351. LA R15,QUEUE1 AND OF QUEUE CONTROL 00370000
  352. L R7,=A(DMKDSPNP) GET ADDRESS OF PAGE COUNTER 00371000
  353. L R7,0(,R7) GET NUMBER OF PAGEABLE PAGES 00372000
  354. LTR R7,R7 CHECK FOR ZERO PAGES @VA03678 00373000
  355. BNZ SETEXIT OK, CONTINUE @VA03678 00374000
  356. LA R7,1 INSURE COUNT OF ONE @VA03678 00375000
  357. SETEXIT LA R8,GETQ2 SET EXIT ADDR FROM SEARCH LOOP @VA03678 00376000
  358. LA R9,CKQ SET RESTART ADDRESS FOR LOOP 00377000
  359. SPACE 00378000
  360. CKQ LR R11,R5 GET ADDRESS OF NEXT USER IN LIST 00379000
  361. CR R11,R6 END OF CHAIN ?? 00380000
  362. BCR 8,R8 YES -- EXIT 00381000
  363. STANDWSS LH R0,VMWSPROJ GET PROJECTED WORKSET SIZE @VA01148 00389000
  364. L R1,PAGUSAGE GET SUM OF ACTIVE WORKSETS 00390000
  365. ALR R1,R0 ADD IN THIS USERS CONTRIBUTION 00391000
  366. CR R1,R7 AND COMPARE SUM TO AVAILABLE PAGES 00392000
  367. BH CKMIN IF SUM EXCEEDS AVAILABLE, EXIT 00393000
  368. ADDTOQ L R5,VMQFPNT OTHERWISE, ADD TO QUEUE 00394000
  369. BAL R14,DROPLIST REMOVE FROM ELIGIBLE LIST 00395000
  370. BAL R14,ADDQ ADD TO QUEUE 1 00396000
  371. BAL R14,ARUNLST AND TO RUNNABLE LIST 00397000
  372. BR R9 RESTART LOOP, OR EXIT 00398000
  373. SPACE 00399000
  374. GETQ2 EQU * CHECK OUT THOSE WAITING FOR Q2 00400000
  375. L R5,WAITQ2 POINT TO 1ST WAITING BLOK 00401000
  376. LA R6,WAITQ2 POINT TO LIST 00402000
  377. LA R8,SETIME SET EXIT ADDRESS FROM SEARCH LOOP 00404000
  378. B CKQ AND LOOK FOR Q2 USERS 00405000
  379. SPACE 00406000
  380. CKMIN EQU * 00407000
  381. LA R9,SETIME SET RESTART ADDRESS TO EXIT 00408000
  382. CR R0,R7 WILL USER EVER FIT ?? 00409000
  383. BL CKNQ YES -- TEST NUMBER IN QUEUE 00410000
  384. LR R0,R7 IF NOT, 00411000
  385. BCTR R0,0 MAKE SURE THAT HE 00412000
  386. STH R0,VMWSPROJ WILL 00413000
  387. SPACE 00414000
  388. CKNQ L R2,DMKSCHN1 GET NUMBER NOW IN QUEUE 1 00415000
  389. TM VMQLEVEL,VMQ1 ADDING TO QUEUE 1 @VA04341 00416500
  390. BO *+8 YES - MUST HAVE AT LEAST 1 @VA04341 00417000
  391. A R2,DMKSCHN2 IF ADDING TO QUEUE2, COUNT ALL USERS 00418000
  392. LTR R2,R2 ARE THERE ANY ?? 00419000
  393. BZ ADDTOQ PUT AT LEAST ONE USER IN Q 00420000
  394. LR R1,R0 SAVE PROJECTED WORKING SET @VA01353 00421000
  395. SRL R1,2 DIVIDE IT BY /4. @VA01353 00422000
  396. SLR R0,R1 GIVES US 75% OF PROJECTED @VA01353 00423000
  397. AL R0,PAGUSAGE ADD IN PRESENT PAGE USAGE. @VA01353 00424000
  398. CR R0,R7 WILL HE FIT NOW ? @VA01353 00425000
  399. BNH ADDTOQ YES - ADD USER TO A QUEUE. @VA01353 00426000
  400. SPACE 00427000
  401. SETIME L R11,BALR11 RESTORE ADDRESS OF ORIGINAL USER 00428000
  402. CHARGE START AND HIS CPU TIMER @V407577 00429100
  403. SPACE 2 00430000
  404. CKFLUSH EQU * HERE TO TEST FOR PAGES TO BE FLUSHED 00431000
  405. TM DMKSCHAL,VMINQ DROPPED FROM Q? @V408246 00432100
  406. BZ SCHEXIT NO - EXIT @V408246 00432200
  407. NI DMKSCHAL,255-VMINQ RESET Q-DROP INDIC @V408246 00432300
  408. TM VMDSTAT,VMINQ VM NOW IN A QUEUE @V4M0207 00432305
  409. BO SCHEXIT YES- BYPASS PAGE RESET CALL @V4M0207 00432310
  410. CL R11,AVMREAL V=R VIRTUAL MACHINE? @VA07342 00432320
  411. BE SCHEXIT YES, BYPASS PAGE RESET @V4M0167 00432340
  412. L R1,=A(DMKPTRUC) FLUSHED PAGE COUNT @VA07810 00432350
  413. L R2,DMKSCHN1 USERS IN Q1 @VA07810 00432355
  414. A R2,DMKSCHN2 PLUS Q2 @VA07810 00432360
  415. C R2,0(R1) BELOW THRESHOLD @VA07810 00432365
  416. BNH SCHEXIT NO- BYPASS PAGE RESET @VA07810 00432370
  417. CALL DMKPTRRS @V408246 00432400
  418. * TEMPR1 SET UP BY DMKPTRRS @V408246 00432600
  419. LH R1,VMWSPROJ GET PROJ WORKING SET SIZE @V408246 00432700
  420. S R1,TEMPR1 SUBTRACT NUMBER OF REF PAGES @V408246 00432800
  421. BNP SCHEXIT OK IF VMWSPROJ <= REF PAGES @V408246 00432900
  422. L R2,TEMPR1 @V408246 00433000
  423. STH R2,VMWSPROJ SET PROJ WS TO NBR OF REF PAGES @V408246 00433100
  424. TM VMDSTAT,VMINQ MADE IT BACK TO QUEUE? @V408246 00433200
  425. BZ CKWAITNG NO- TRY AGAIN @V408246 00433300
  426. L R2,PAGUSAGE ADJUST SUM OF USERS WORKING SETS @V408246 00433400
  427. SR R2,R1 BY AMOUNT OF OVER ESTIMATE OF WS @V408246 00433500
  428. LTR R2,R2 WILL PAGE USEAGE GO NEGATIVE @VA08454 00433520
  429. BP CKFLUSH1 NO, LET IT GO @VA08454 00433540
  430. SR R2,R2 YES, ZERO IS MINIMUM COUNT @VA08454 00433560
  431. CKFLUSH1 EQU * @VA08454 00433580
  432. ST R2,PAGUSAGE @V408246 00433600
  433. B CKWAITNG TRY TO ADD USERS TO QUEUE @V408246 00433700
  434. SPACE 2 00447000
  435. SCHEXIT EQU * EXIT FROM SHCEDULER 00448000
  436. LM R0,R15,BALRSAVE RESTORE CALLER'S REGISTERS 00449000
  437. BR R14 AND RETURN 00450000
  438. EJECT 00451000
  439. ADDQ EQU * HERE WHEN USER IS BEING PUT IN ACTIVE QUEUE 00452000
  440. * 00453000
  441. * THE VMBLOK FOR THIS USER IS TIME STAMPED AS FOLLOWS. 00455000
  442. * 00456000
  443. * 00459000
  444. * A. VMTODINQ = TOD CLOCK 00460000
  445. * B. VMTMOUTQ = AMOUNT OF TIME ALLOWED TO STAY IN QUEUE 00461000
  446. * C. VMTMINQ = CURRENT VALUE OF (VMTTIME) 00462000
  447. * SUPERVISOR OVERHEAD TIME FOR THIS USER. IT 00463000
  448. * IS REPRESENTED BY THE DIFFERENCED FROM 00464000
  449. * X'7FFFFFFFFFFFF000'. 00465000
  450. SPACE 00466000
  451. USING VMQBLOK,R15 00467000
  452. TM VMDSTAT,VMINQ CURRENTLY IN A QUEUE ? @VA04341 00467100
  453. BOR R14 YES - RETURN TO CALLER @VA04341 00467200
  454. LA R15,QUEUE2 ASSUME ADDING TO QUEUE 2 @VA04341 00467300
  455. TM VMQLEVEL,VMQ1 WERE WE CORRECT @VA04341 00467400
  456. BZ *+8 IF YES - QUEUE BLOCK POINTER @VA04341 00467500
  457. * ALL SET 00467600
  458. LA R15,QUEUE1 OTHERWISE SET FOR QUE 1 @VA04341 00467700
  459. STM R14,R15,TEMPR14 SAVE REGISTERS FOR LATER CALLS @VA07582 00467800
  460. OI VMDSTAT,VMINQ FLAG AS IN QUEUE 00468000
  461. STCK VMTODINQ TOD CLOCK AT QUEUE ENTRY 00469000
  462. BC 12,CLOCKOK IS CLOCK FUNCTIONING? @VA04301 00469250
  463. DOWNWEGO GOTO DMKCVTAB CLOCK DAMAGED...ABEND WITH CVT001@VA04301 00469500
  464. CLOCKOK EQU * @VA04301 00469750
  465. LM R0,R2,VMQTIME GET TIME SLICE AND NUMBER IN QUEUE 00470000
  466. TM VMPSTAT,VMV370R EC MODE MACHINE ? 00471000
  467. BZ NOQUETMR NO - CAN'T HAVE CPU TIMER 00472000
  468. L R10,VMECEXT GET EXTENSION VMBOLK 00473000
  469. L R3,EXTCPTRQ-ECBLOK(,R10) ADDRESS OF TIMER REQ. BLOCK 00474000
  470. STM R0,R1,TRQBQUE-TRQBLOK(R3) SAVE QUEUE DROP INTERVAL 00475000
  471. CLC EXTCPTMR-ECBLOK(8,R10),VMQTIME VIRT TIMER < QTIME ? 00476000
  472. BH NOQUETMR NO - 00477000
  473. LM R0,R1,EXTCPTMR-ECBLOK(R10) GET VIRTUAL TIME 00478000
  474. OI VMTLEVEL,VMCPUTMR VIRT. CPU TIMER RUNNING AS REAL 00479000
  475. SPACE 00480000
  476. NOQUETMR EQU * HERE IF VIRTUAL CPU TIMER > QUEUE DROP INTERVAL 00481000
  477. TM CPSTATUS,CPRUN WAS SYSTEM IN PROBLEM STATE? @VA07582 00481100
  478. BZ NOPROBT NO, CONTINUE NORMALLY @VA07582 00481200
  479. C R11,RUNUSER IS THIS USER RUNUSER? @VA07582 00481300
  480. BNE NOPROBT NO, CONTINUE NORMALLY @VA07582 00481400
  481. BAL R14,INCPROBT GO INCREMENT PROBTIME NOW SINCE @VA07582 00481500
  482. * VMTMOUTQ IS TO BE CHANGED 00481600
  483. L R14,TEMPR14 RELOAD RETURN REGISTER @VA07582 00481700
  484. STM R0,R1,PROBSTRT SET PROBSTRT FOR DSP CALCULATION @VA07582 00481800
  485. NOPROBT DS 0H @VA07582 00481900
  486. ST R0,VMTMOUTQ STORE TIME ALLOWED TO STAY IN QUEUE 00482000
  487. ST R1,VMTMOUTQ+4 ... 00483000
  488. LA R10,1 CONSTANT FOR ARITHMETIC 00484000
  489. ALR R2,R10 INCREMENT NUM. USER'S IN QUEUE. 00485000
  490. ST R2,VMQNUM SAVE IT 00486000
  491. CHARGE SYNC UPDATE VMTTIME @V4M0203 00486200
  492. LM R14,R15,TEMPR14 RESTORE CALLER'S REGISTERS @V4M0203 00486300
  493. SPACE 00487000
  494. SPACE 00488000
  495. LM R0,R1,VMTTIME GET TOTAL SUPERVISOR TIME TO DATE 00489000
  496. SL R1,VMQTIME+4 SUBTRACT OUT SUPERVISOR TIME SLICE .. 00490000
  497. BC 8+2+1,*+6 ... 00491000
  498. SLR R0,R10 .. 00492000
  499. SL R0,VMQTIME . 00493000
  500. STM R0,R1,VMTMINQ AND SAVE AS Q-DROP TIME 00494000
  501. SPACE 00495000
  502. TM VMQLEVEL,VMAEXP ASSURED PERCENTAGE USER ? 00496000
  503. BZ LOADUP NO -- GO SET PAGE LOAD 00497000
  504. SPACE 00498000
  505. LM R2,R3,VMTTIME GET TOTAL SUPERVISOR OVERHEAD @VA04341 00499300
  506. LA R4,AEXPQUE2 ASSUME QUE 2 TIME SLICE @VA04341 00499600
  507. TM VMQLEVEL,VMQ1 IS USER IN QUE 1 @VA04341 00499900
  508. BZ *+8 NO - THEN R4 IS POINTING @VA04341 00500200
  509. * CORRECTLY 00500500
  510. LA R4,AEXPQUE1 POINT TO QUE 1 TIME SLICE @VA04341 00500800
  511. TM VMQLEVEL,VMHIPRI IS THIS FIRST HALF OF PERCENT @VA04341 00501100
  512. BZ QAEXLAST NO - SET UP LAST HALF @VA04341 00501400
  513. LM R0,R1,0(R4) GET FAVORED PERCENTAGE IN MICRO @VA04341 00501700
  514. * SEC. 00502000
  515. SLR R3,R1 REMOVE PERCENTAGE FROM VMTTIME @VA04341 00502300
  516. BC 8+2+1,*+6 ADJUST FOR CARRY @VA04341 00502600
  517. SLR R2,R10 SUBTRACT FOR CARRY CONDITION @VA04341 00502900
  518. SLR R2,R0 NOW CLEAN UP HIGH WORD @VA04341 00503200
  519. STM R2,R3,VMTMINQ LIMIT SUPERVISOR OVERHEAD TIME @VA04341 00503500
  520. STM R0,R1,SCHBAEXP SAVE TIME SLICE FOR 'CALCPRI' @VA04815 00503600
  521. TM VMPSTAT,VMV370R EC MODE MACHINE @VA04341 00503800
  522. BZ NOAEXTMR NO - CAN'T HAVE CPU TIMER @VA04341 00504100
  523. L R10,VMECEXT GET VMBLOK EXTENSION @VA04341 00504400
  524. L R3,EXTCPTRQ-ECBLOK(,R10) ADDR. OF TIMER @VA04341 00504700
  525. * REQUEST BLOK 00505000
  526. STM R0,R1,TRQBQUE-TRQBLOK(R3) SAVE QUEUE DROP TIME @VA04341 00505300
  527. * SLICE 00505600
  528. CLC EXTCPTMR-ECBLOK(8,R10),SCHBAEXP VIRT. < QUEUE @VA04341 00506200
  529. * SLICE 00506500
  530. BH NOAEXTMR NO @VA04341 00506800
  531. LM R0,R1,EXTCPTMR-ECBLOK(R10) GET VIRT. CPU TIMER @VA04341 00507100
  532. OI VMTLEVEL,VMCPUTMR VIRT. TIMER IN REAL TIMER @VA04341 00507400
  533. NOAEXTMR STM R0,R1,VMTMOUTQ STORE ASSURED TIME SLICE @VA04341 00507700
  534. NI VMQLEVEL,VMHIPRI+VMQ1+VMAEX+VMAEXP LEAVE THESE @VA04341 00508000
  535. TM CPSTATUS,CPRUN WAS SYSTEM IN PROBLEM STATE? @VA07582 00508050
  536. BZ LOADUP NO, CONTINUE NORMALLY @VA07582 00508100
  537. C R11,RUNUSER IS THIS USER RUNUSER? @VA07582 00508150
  538. BNE LOADUP NO, CONTINUE NORMALLY @VA07582 00508200
  539. STM R0,R1,PROBSTRT SET PROBSTRT FOR DSP CALCULATION @VA07582 00508250
  540. B LOADUP SET PAGE USAGE @VA04341 00508300
  541. QAEXLAST LM R2,R3,8(R4) PERCENT OF STANDARD TIME SLICE @VA04341 00508600
  542. LM R0,R1,VMTODINQ GET TOD AT QUEUE ENTRY @VA04341 00508900
  543. ALR R1,R3 AND ADD TO IT @VA04341 00509200
  544. BC 8+4,*+6 THE REMAINING TIME @VA04341 00509500
  545. ALR R0,R10 THAT THIS USER @VA04341 00509800
  546. ALR R0,R2 WILL BE AT LOW PRIORITY IN @VA04341 00510100
  547. * RUNLIST 00510400
  548. STM R0,R1,SCHBVAL TOD CLOCK INTERRUPT VALUE @VA04341 00510700
  549. ST R11,SCHBUSER FAVORED PERCENTAGE VMBLOK @VA04341 00511000
  550. LA R1,SCHBLOK ADDRESS OF TRQBLOK @VA04341 00511300
  551. BAL R14,SETIMER ESTABLISH CLOCK COMPARATOR @VA04341 00511900
  552. * REQUEST 00512200
  553. L R14,TEMPR14 RESTORE BAL REGISTER @VA04341 00512500
  554. SPACE 00520000
  555. LOADUP L R0,PAGUSAGE GET CURRENT PAGE USAGE 00521000
  556. AH R0,VMWSPROJ ADD THIS USER'S LOAD 00522000
  557. ST R0,PAGUSAGE AND SAVE NEW VALUE 00523000
  558. SCHMN3 MC MNCOAQ,MNCLSCH MONITOR ADD TO Q @VM01017 00524000
  559. SPACE 00525000
  560. SLR R1,R1 INITIALIZE 00526000
  561. STH R1,VMSTEALS COUNTERS 00527000
  562. L R0,VMPGREAD FOR 00528000
  563. LH R1,VMPAGES QUEUE 00529000
  564. SRL R1,1 DROP 00530000
  565. STM R0,R1,VMRDINQ ............... 00531000
  566. BR R14 RETURN TO CALLER 00532000
  567. EJECT 00533000
  568. *. 00534000
  569. * OPERATION - 00535000
  570. * 00536000
  571. * C. QUEUE DROP CALCULATIONS 00537000
  572. * 1A. UPDATE SMOOTHED VALUES OF UTILIZATION AND CONTENTION 00538000
  573. * FOR CPU AND CORE 00539000
  574. * 1B. IF USER IS RUNNING AN EC-MODE MACHINE, CALCULATE THE 00540000
  575. * AMOUNT OF TIME HIS VIRTUAL CPU TIMER SHOULD BE UPDATED. 00541000
  576. * THE CALCULATION IS AS FOLLOWS; 00542000
  577. * 00543000
  578. * A. IF VIRTUAL CPU TIMER IS NOT IN REAL CPU TIMER - 00544000
  579. * TRQBQUE-VMTMOUTQ=DIFFERENCE 00545000
  580. * EXTCPTMR-DIFFERENCE= NEW VIRTUAL CPU TIMER 00546000
  581. * 00547000
  582. * B. IF VIRTUAL CPU TIMER IS IN THE REAL CPU TIMER - 00548000
  583. * VMTMOUTQ= NEW VIRTUAL CPU TIMER 00549000
  584. * 1C. UNFLAG USER-IN-Q, SUBTRACT WORKSET FROM SYSTEM PAGE USAGE, 00550000
  585. * AND DECREMENT NUMBER OF IN-Q USERS 00551000
  586. * 2. CALCULATE ELAPSED TIME IN QUEUE AND DIVIDE INTO CPU TIME 00552000
  587. * WHILE IN QUEUE. THE RESULT, MULTIPLIED BY 4096, WILL BE 00553000
  588. * THE USER'S DISPATCHING PRIORITY NEXT TIME HE IS RUN 00554000
  589. * 3. COMPARE THE ACTUAL WORKING SET TO THE PROJECTED WORKING SET 00562100
  590. * AND NOTE THE ALGEBRAIC SIGN OF THE ERROR. IF THE SIGN OF 00563000
  591. * THE CURRENT ERROR IS THE SAME AS THAT OF THE LAST ERROR 00564000
  592. * COMPUTED, REPLACE THE PROJECTED WORKING SET WITH THE ACTUAL 00565000
  593. * WORKING SET. IF THE SIGNS OF THE ERRORS ARE OPPOSITE, RE- 00566000
  594. * PLACE THE PROJECTED WORKING SET SIZE WITH THE AVERAGE OF 00567000
  595. * THE PROJECTED AND ACTUAL WORKING SETS 00568000
  596. *. 00569000
  597. SPACE 2 00570000
  598. DROPQ EQU * DROP THIS USER FROM AN ACTIVE QUEUE 00571000
  599. TM VMDSTAT,VMINQ CURRENTLY IN A QUEUE @VA04341 00571100
  600. BZR R14 NO - RETURN @VA04341 00571200
  601. ST R14,TEMPR14 SAVE RETURN REGISTER @VA08518 00571300
  602. SPACE 00572000
  603. TM VMDSTAT,VMQSEND WAS HE TIME SLICE ENDED? @V2B2638 00573000
  604. BZ DROPQPC NO @V2B2638 00574000
  605. OI DMKSCHAL,TSEND YES, INDICATE SO FOR MONITOR @V2B2638 00575000
  606. DROPQPC EQU * @V2B2638 00576000
  607. NI VMDSTAT,X'FF'-(VMINQ+VMDSP+VMQSEND) UNFLAG USER 00577000
  608. L R3,PAGUSAGE GET SUM OF WSS IN Q USE @V2B2638 00578000
  609. LTR R3,R3 OUTSIDE CHANCE OF ZERO WSS SIZE @V2B2638 00579000
  610. BZ QRT @V2B2638 00580000
  611. SR R2,R2 @VA03678 00581000
  612. SLL R3,10 *1024 FOR ACCURACY @V2B2638 00582000
  613. L R7,=A(DMKDSPNP) ADDRESS OF PAGE COUNTER @V2B2638 00583000
  614. L R7,0(R7) NUMBER OF PAGABLE PAGES @V2B2638 00584000
  615. LTR R7,R7 CHECK FOR ZERO PAGES @VA03678 00585000
  616. BZ QRT BYPASS SUBTRACT INSTR IF ZERO @VA03678 00586000
  617. DR R2,R7 DIVIDED BY PAGABLE PAGES @V2B2638 00587000
  618. QRT L R7,DMKSCHCO SMOOTH CORE UTILIZATION VALUE @V2B2638 00588000
  619. SR R6,R6 @V2B2638 00589000
  620. M R6,F15 X15 @V2B2638 00590000
  621. AR R3,R7 TOTAL @V2B2638 00591000
  622. SRL R3,4 (NEW + 15*OLD)/16 @V2B2638 00592000
  623. A R3,F8 ROUND BY LOGICAL 0.5 @VA05456 00592100
  624. ST R3,DMKSCHCO NEW SMOOTHED CORE UTILIZATION @V2B2638 00593000
  625. SPACE 00594000
  626. L R0,DMKSCHN1 CURRENT NUMBER OF USERS IN Q1 @V2B2638 00595000
  627. L R1,DMKSCHN2 CURRENT NUMBER OF USERS IN Q2 @V2B2638 00596000
  628. SLDL R0,10 *1024 FOR ACCURACY @V2B2638 00597000
  629. LH R3,DMKSCHW1 USERS ELIGIBLE FOR Q1 @V2B2638 00598000
  630. AH R3,DMKSCHW2 USERS ELIGIBLE FOR Q2 @V2B2638 00599000
  631. SLL R3,10 (E1+E2)*1024 @V2B2638 00600000
  632. LR R4,R0 @V2B2638 00601000
  633. AR R4,R1 (Q1+Q2)*1024 @V2B2638 00602000
  634. AR R3,R4 (Q1+Q2+E1+E2)*1024 @V2B2638 00603000
  635. SPACE 00604000
  636. SMOOTHQ1 SR R6,R6 CLEAR FOR MULTIPLY @V2B2638 00605000
  637. L R7,DMKSCHS1 YES,GET OLD SMOOTHED Q1 VALUE @V2B2638 00606000
  638. M R6,F15 @V2B2638 00607000
  639. AR R0,R7 15*S1+Q1 @V2B2638 00608000
  640. A R0,F8 ROUND BY LOGICAL 0.5 @VA05456 00608100
  641. SRL R0,4 (15S1+Q1)/16 @V2B2638 00609000
  642. ST R0,DMKSCHS1 NEW SMOOTHED @V2B2638 00610000
  643. SPACE 00611000
  644. SMOOTHQ2 L R7,DMKSCHS2 OLD SMOOTHED Q2 @V2B2638 00612000
  645. M R6,F15 @V2B2638 00613000
  646. AR R1,R7 15S2+Q2 @V2B2638 00614000
  647. A R1,F8 ROUND BY LOGICAL 0.5 @VA05456 00614100
  648. SRL R1,4 (15S2+Q2)/16 @V2B2638 00615000
  649. ST R1,DMKSCHS2 NEW SMOOTHED Q2 @V2B2638 00616000
  650. SPACE 00617000
  651. SMOOTHSC SR R2,R2 CLEAR FOR DIVIDE @V2B2638 00618000
  652. SRL R4,10 BACK TO NORMAL TO RETAIN ACCURACY@V2B2638 00619000
  653. DR R2,R4 (Q1+Q2+E1+E2)*1024/(Q1+Q2) @V2B2638 00620000
  654. L R7,DMKSCHSC OLD SMOOTHED RATIO @V2B2638 00621000
  655. M R6,F15 @V2B2638 00622000
  656. AR R3,R7 (15*OLD RATIO + NEW RATIO) @V2B2638 00623000
  657. A R3,F8 ROUND BY LOGICAL 0.5 @VA05456 00623100
  658. SRL R3,4 (15OLD +NEW)/16 @V2B2638 00624000
  659. ST R3,DMKSCHSC NEW SMOOTHED RATIO @V2B2638 00625000
  660. SPACE 00626000
  661. L R0,PAGUSAGE GET SYSTEM PAGE USAGE 00627000
  662. SH R0,VMWSPROJ SUBTRACT THIS USER'S CONTRIBUTION 00628000
  663. LTR R0,R0 WILL PAGE USAGE GO NEGATIVE @VA08454 00628100
  664. BP SMOOTHS1 NO, LET IT GO @VA08454 00628200
  665. SR R0,R0 YES, ZERO IS MINIMUM COUNT @VA08454 00628300
  666. SMOOTHS1 EQU * @VA08454 00628400
  667. ST R0,PAGUSAGE AND SAVE NEW VALUE 00629000
  668. LA R15,QUEUE2 DROPPING FROM Q2 MOST LIKELY 00630000
  669. TM VMQLEVEL,VMQ1 REALLY DROPPING FROM 1 ?? 00631000
  670. BZ DROPQ2 NO -- 00632000
  671. LA R15,QUEUE1 POINT TO QUEUE1 ANCHOR 00633000
  672. OI DMKSCHAL,Q1DROP INDICATE (FOR MONITOR) DROPPING FROM 1 00634000
  673. OI VMQLEVEL,VMDROP1 FLAG Q1 DROP 00635000
  674. DROPQ2 L R2,VMQNUM GET NUMBER NOW IN Q 00636000
  675. S R2,F1 DECREMENT AND TEST 00637000
  676. BNM SCH1A EVERYTHING OK -- 00638000
  677. ABEND 1 DIE 00639000
  678. SCH1A EQU * 00640000
  679. ST R2,VMQNUM UPDATE NUMBER IN Q 00641000
  680. SPACE 00642000
  681. ST R15,TEMPR15 SAVE R15 ACROSS CHARGE @VA07582 00643110
  682. CHARGE STOP GET CPU TIME AT Q-DROP @V407577 00643200
  683. L R15,TEMPR15 RESTORE R15 VALUE @VA07582 00643310
  684. LA R8,1 CONSTANT 00644000
  685. SPACE 00645000
  686. TM VMPSTAT,VMV370R EC MODE ALLOWED FOR THIS USER 00646000
  687. BZ NOCPUTMR NO - CAN'T HAVE VIRTUAL CPU TIMER 00647000
  688. L R6,VMECEXT GET VMBLOK EXTENSION FOR EC MACHINE 00648000
  689. LM R4,R5,EXTCPTMR-ECBLOK(R6) GET USER'S CPU TIMER 00649000
  690. L R7,EXTCPTRQ-ECBLOK(,R6) GET ADDR. OF TIMER REQUEST BLOK 00650000
  691. LM R2,R3,TRQBQUE-TRQBLOK(R7) GET TIME LEFT IN QUEUE 00651000
  692. LM R0,R1,VMTMOUTQ .. 00652000
  693. LTR R0,R0 WAS ALL THE ALLOCATED TIMED USED 00653000
  694. BNM *+8 NO - USE VALUE THAT REMAINS @VA07582 00654100
  695. LM R0,R1,ZEROES CAN'T USE A NEGATIVE NUMBER 00655000
  696. SPACE 00657000
  697. TM VMTLEVEL,VMCPUTMR DOES USER CPU TIMER = REAL TIMER 00658000
  698. BO TRACKTMR YES - SPECIAL CONSIDERATIONS 00659000
  699. SLR R3,R1 CALCULATE AMOUNT OF TIME THAT 00660000
  700. BC 8+2+1,*+6 VIRTUAL CPU TIMER SHOULD BE 00661000
  701. SLR R2,R8 UPDATED WITH. 00662000
  702. SLR R2,R0 ... 00663000
  703. SPACE 00664000
  704. SLR R5,R3 NOW THAT WE KNOW THE 00665000
  705. BC 8+2+1,*+6 DIFFERENCE. SUBTRACT IT 00666000
  706. SLR R4,R8 FROM THE VIRTUAL CPU TIMER 00667000
  707. SLR R4,R2 THIS LEAVES THE VIRTUAL 00668000
  708. STM R4,R5,EXTCPTMR-ECBLOK(R6) CPU TIMER CORRECT.. 00669000
  709. B QUETIME NOW CALCULATE PROBLEM TIME USED. 00670000
  710. SPACE 00671000
  711. TRACKTMR NI VMTLEVEL,X'FF'-VMCPUTMR NO-LONGER TRACKING CPU TIMER. 00672000
  712. TM VMTLEVEL,VMTMRINT IS IT ALSO CPU TIMER INTERRUPT 00673000
  713. BO QUETIME YES - HIS VIRTUAL CPU TIMER IS OK. 00674000
  714. SLR R5,R1 CALCULATE AMOUNT OF TIME 00675000
  715. BC 8+2+1,*+6 THAT SHOULD BE CHARGED TO THIS 00676000
  716. SLR R4,R8 USER'S VIRTUAL PROBLEM TIME USED. 00677000
  717. SLR R4,R0 ... 00678000
  718. SPACE 00679000
  719. SLR R3,R5 FIND TOTAL TIME THAT THIS USER 00680000
  720. BC 8+2+1,*+6 ACTUALLY USED WHILE HE WAS 00681000
  721. SLR R2,R8 IN THE QUEUE. 00682000
  722. SLR R2,R4 ... 00683000
  723. SPACE 00684000
  724. STM R0,R1,EXTCPTMR-ECBLOK(R6) STORE VIRTUAL CPU TIMER. 00685000
  725. TM CPSTATUS,CPRUN WAS SYSTEM IN PROBLEM STATE? @VA07582 00685100
  726. BZ NOPROBT2 NO, CONTINUE NORMALLY @VA07582 00685200
  727. C R11,RUNUSER IS THIS USER RUNUSER? @VA07582 00685300
  728. BNE NOPROBT2 NO, CONTINUE NORMALLY @VA07582 00685400
  729. BAL R14,INCPROBT GO INCREMENT PROBTIME NOW SINCE @VA07582 00685500
  730. * VMTMOUTQ IS TO BE CHANGED 00685600
  731. STM R2,R3,PROBSTRT SET PROBSTRT FOR DSP CALCULATION @VA07582 00685800
  732. NOPROBT2 DS 0H @VA07582 00685900
  733. STM R2,R3,VMTMOUTQ STORE AMOUNT OF TIME THAT IS LEFT OVER 00686000
  734. SPACE 00687000
  735. NOCPUTMR EQU * HERE IF USER IS NON- EC MODE MACHINE 00688000
  736. QUETIME EQU * HERE TO CALCULATE AMOUNT OF PROBLEM TIME USED. 00689000
  737. SPACE 00690000
  738. NI VMTLEVEL,X'FF'-VMTMRINT RESET TIMER INTERRUPT FLAG 00691000
  739. LM R2,R3,VMTMOUTQ GET TIME VALUE REMAINING IN QUEUE 00692000
  740. TM VMQLEVEL,VMAEXP ASSURED PERCENTAGE USER @VA04341 00693050
  741. BZ GETQTMR NO _ @VA04341 00693100
  742. LM R0,R1,SCHBAEXP GET PERCENTAGE TIME SLICE @VA04341 00693150
  743. TM VMQLEVEL,VMHIPRI DROPPING WITHIN FIRST PART @VA04341 00693200
  744. * PERCENT 00693250
  745. BO AEXQTMR YES - @VA04341 00693300
  746. CLC SCHBVAL,ZEROES WAS CLOCK COMPARATOR THIS ONE ???@VA04341 00693350
  747. BE GETQTMR YES - THEN ITS ALREADY RESET @VA04341 00693400
  748. * FOR INT. 00693450
  749. LA R1,SCHBLOK RESET CLOCK COMPARATOR @VA04341 00693550
  750. BAL R14,RESETIMR FOR LAST PART OF PERCENTAGE @VA04341 00693600
  751. GETQTMR LM R0,R1,VMQTIME GET STANDARD TIME SLICE INTERVAL @VA04341 00693700
  752. AEXQTMR LTR R2,R2 DID USER USE ALL TIME ALLOTED @VA04341 00693750
  753. BM USEDALL YES - 00695000
  754. SLR R1,R3 NO - CALCULATE TIME HE DID USE 00696000
  755. BC 8+2+1,*+6 WHILE HE WAS IN THE QUEUE. 00697000
  756. SLR R0,R8 00698000
  757. SLR R0,R2 00699000
  758. SPACE 00700000
  759. USEDALL EQU * 00701000
  760. L R2,VMVTIME CALCULATE TOTAL PROB. STATE TIME 00702000
  761. L R3,VMVTIME+4 ... 00703000
  762. ALR R3,R1 00704000
  763. BC 8+4,*+6 00705000
  764. ALR R2,R8 00706000
  765. ALR R2,R0 00707000
  766. STM R2,R3,VMVTIME STORE TOTAL PROB. STATE TIME 00708000
  767. CHARGE SYNC UPDATE VMTTIME @V4M0203 00715150
  768. BAL R14,CALCPRI CALCULATE DISPATCHING PRIORITY @V407577 00715200
  769. NI VMQLEVEL,X'FF'-VMQ1 RESET Q1 FLAG 00716000
  770. SLR R4,R4 RESET REGISTER 4 @VA05979 00716500
  771. CL R11,AVMREAL IS THIS THE VIRTUAL = REAL USER ? 00717000
  772. BC 8,SAVEWS+4 YES--BYPASS WORKING SET CALCULATION 00718000
  773. EJECT 00719000
  774. * 00720000
  775. * CALCULATE WORKING SET SIZE AND FLUSH ACTIVE PAGES 00721000
  776. * 00722000
  777. SPACE 00723000
  778. LH R1,VMPAGES GET NUMBER OF RESIDENT PAGES 00725000
  779. EJECT 00778000
  780. WORKSET EQU * COMPUTE PROJECTED WORKSET SIZE 00779000
  781. LR R4,R1 SAVE PAGE REF COUNT FOR MONITOR 00780000
  782. AIF (NOT &TRACE(9)).TR3 00782000
  783. TM TRACFLG1,TRAC09 TRACING ACTIVE? 00783000
  784. BZ NOTRAC3 BRANCH IF NOT 00784000
  785. TRACE CODE=TRCDROP,R15,R1,R2 TRACE DROP QUEUE @V407577 00785100
  786. MVC 12(4,R15),PAGELOAD SAVE SYS PAGE LOAD AND RATE @VA07681 00786500
  787. LH R2,VMWSPROJ WORKING SET PROJECTION @V200820 00788000
  788. ICM R2,B'1100',VMPAGES NO. RESIDENT PAGES @V200820 00789000
  789. ST R2,8(,R15) ... 00790000
  790. STCM R11,B'0111',1(R15) SAVE USERS VMBLOK @V407577 00791100
  791. LH R2,VMQPRIOR GET NEW PRIORITY @VA01166 00793000
  792. ST R2,4(,R15) SAVE NEW PRIORITY @VA01166 00794000
  793. NOTRAC3 EQU * 00800000
  794. .TR3 ANOP 00801000
  795. L R1,VMPGRINQ GET SUM OF RESIDENT PAGES @ EACH READ 00802000
  796. SLR R0,R0 CLEAR FOR DIVISION 00803000
  797. L R2,VMPGREAD GET TOTAL PAGE READS 00804000
  798. S R2,VMRDINQ GET PAGE READS WHILE IN Q 00805000
  799. BP *+8 INSURE AT 00806000
  800. LA R2,1 ONE FOR DIVIDE 00807000
  801. DR R0,R2 GET AVERAGE PAGES RESIDENT/READ 00808000
  802. AH R1,VMSTEALS PLUS NUMBER OF WAITS FOR STOLEN PAGES 00809000
  803. SPACE 00813000
  804. * R1 NOW HAS MEASURED WORKING SET 00814000
  805. SPACE 00815000
  806. SPACE 00816000
  807. TM VMPSTAT,VMRPAGE RESERVED PAGE USER ?? 00817000
  808. BZ PROJECT NO -- USE AVERAGE AS IT STANDS 00818000
  809. L R15,=A(DMKPTRRL) GET MAXIMUM RESERVED COUNT 00819000
  810. S R1,0(,R15) AND SUBTRACT FROM PROJECTION 00820000
  811. BP PROJECT USE DIFFERENCE AS USER'S IMPACT 00821000
  812. SLR R0,R0 IF USING LESS THAN GUARANTEE, 00822000
  813. B SAVEWS ASSUME LOAD OF 0 00823000
  814. SPACE 00824000
  815. PROJECT EQU * 00825000
  816. LR R0,R1 SAVE ACTUAL WORKSET 00826000
  817. SH R1,VMWSPROJ GET DIFFERENCE FROM WHAT WAS PROJECTED 00827000
  818. LR R2,R1 AND SAVE THE ERROR 00828000
  819. LA R3,FFS SET FOR NEGATIVE PROJECTION ERROR 00829000
  820. TM VMQSTAT,VMWSERNG WAS LAST ERROR NEGATIVE ? 00830000
  821. BO *+8 YES -- ALL SET 00831000
  822. LA R3,F1+2 SET FOR POSITIVE ERROR 00832000
  823. MH R1,0(,R3) COMPARE SIGNS OF ERRORS 00833000
  824. NI VMQSTAT,X'FF'-VMWSERNG CLEAR ERROR FLAG 00834000
  825. LTR R2,R2 CURRENT ERROR NEGATIVE ? 00835000
  826. BNM *+8 NO -- LEAVE FLAG OFF 00836000
  827. OI VMQSTAT,VMWSERNG YES - FLAG NEGATIVE ERROR 00837000
  828. LTR R1,R1 ERROR THIS TIME SAME DIRECTION AS LAST 00838000
  829. BP SAVEWS YES -- TRACKING TOO SLOWLY - USE ACTUAL 00839000
  830. AH R0,VMWSPROJ IF ERRORS ARE OF OPPOSITE SIGN, 00840000
  831. SRL R0,1 TAKE AVERAGE OF ACTUAL AND PROJECTED 00841000
  832. SAVEWS STH R0,VMWSPROJ SAVE NEW PROJECTED WORKSET 00842000
  833. SCHMN2 EQU * @VA08518 00843100
  834. L R14,TEMPR14 RESTORE RETURN REGISTER @VA08518 00843300
  835. MC MNCODQ,MNCLSCH MONITOR DROP FROM Q @VA08518 00843500
  836. NI DMKSCHAL,255-Q1DROP-TSEND RESET MONITOR FLAGS @V2B2638 00844000
  837. OI DMKSCHAL,VMINQ SET FLAG FOR FLUSH LIST CK @V408246 00844100
  838. BR R14 AND RETURN TO CALLER 00845000
  839. SPACE 2 00846000
  840. EJECT 00848000
  841. * 00849000
  842. * RE-CALCULATE DISPATCHING PRIORITY (VMQPRIOR) AT Q DROP OR MINOR TIME 00850000
  843. * SLICE END AS : VMQPRIOR = (EXECUTION TIME/ELAPSED TIME)*4096. 00851000
  844. * EXECUTION TIME IS CALCULATED AS : 00852000
  845. * EX.T. = VMQTIME*2+VMTMINQ-VMTTIME-VMTMOUTQ(+EXTCPTMR-TRQBQUE) 00853000
  846. * NOTE THAT THE FINAL TERM IS USED ONLY IF VMTMOUTQ CONTAINS A 00854000
  847. * RESIDUAL VIRTUAL CPU TIMER VALUE RATHER THAN A TIME IN QUEUE 00855000
  848. * ELAPSED TIME IS CALCULATED AS : 00856000
  849. * EL.T. = TOD - VMTODINQ 00857000
  850. * 00858000
  851. SPACE 00859000
  852. CALCPRI EQU * FIRST, LOAD UP ALL PERTINENT TIME VALUES ... 00860000
  853. LM R0,R7,VMTMOUTQ ,VMTTIME,VMTMINQ, AND VMTODINQ ... 00861000
  854. LA R15,DMKSCHQ1 POINT TO APPROPRIATE Q CONTROL BLOCK 00862000
  855. TM VMQLEVEL,VMQ1 RUNNING IN Q1 ?? 00863000
  856. BO *+8 YES -- QUEUE CONTROL IS CORRECT 00864000
  857. LA R15,DMKSCHQ2 CORRECT QUEUE CONTROL 00865000
  858. LM R8,R9,VMQTIME-VMQBLOK(R15) AND LOAD UP TIME SLICE 00866000
  859. TM VMQLEVEL,VMAEXP+VMHIPRI ASSURED PERCENT AND @VA04341 00866100
  860. * FIRST HALF 00866200
  861. BNO *+8 NO @VA04341 00866300
  862. LM R8,R9,SCHBAEXP YES - USE HIS PERCENT OF TIME @VA04341 00866400
  863. * SLICE 00866500
  864. SLDL R8,1 GET VMQTIME*2 00867000
  865. LA R15,1 FREQUENTLY USED CONSTANT ... 00868000
  866. SPACE 00869000
  867. ALR R9,R5 VMQTIME*2 + VMTMINQ 00870000
  868. BC 8+4,*+6 ... 00871000
  869. ALR R8,R15 ... 00872000
  870. ALR R8,R4 ... 00873000
  871. SPACE 00874000
  872. SLR R9,R3 - VMTTIME 00875000
  873. BC 8+2+1,*+6 ... 00876000
  874. SLR R8,R15 ... 00877000
  875. SLR R8,R2 ... 00878000
  876. SPACE 00879000
  877. LTR R0,R0 DID WE TIME SLICE END(VMQSEND)? @VA01553 00880000
  878. BNM *+8 NO- USE VALUE IN VMTMOUTQ @VA01553 00881000
  879. LM R0,R1,ZEROES YES- CAN'T ALLOW NEGATIVE @VA01553 00882000
  880. * CALCULATION 00883000
  881. SLR R9,R1 - VMTMOUTQ @VA01553 00884000
  882. BC 8+2+1,*+6 ... 00885000
  883. SLR R8,R15 ... 00886000
  884. SLR R8,R0 ... 00887000
  885. SPACE 00888000
  886. TM VMTLEVEL,VMCPUTMR RESIDUAL TIMER IN VMTMOUTQ ?? 00889000
  887. BZ ELAPSED NO -- EXECUTION TIME COMPLEATE 00890000
  888. L R1,VMECEXT POINT TO VMBLOK EXTENSION ... 00891000
  889. AL R9,EXTCPTMR-ECBLOK+4(,R1) GET TIME+EXTCPTMR 00892000
  890. BC 8+4,*+6 00893000
  891. ALR R8,R15 ... 00894000
  892. AL R8,EXTCPTMR-ECBLOK(,R1) ... 00895000
  893. SPACE 00896000
  894. L R1,EXTCPTRQ-ECBLOK(,R1) POINT TO TIMER CONTROL BLOK 00897000
  895. SL R9,TRQBQUE-TRQBLOK+4(,R1) GET TIME - TRQBQUE 00898000
  896. BC 8+2+1,*+6 ... 00899000
  897. SLR R8,R15 ... 00900000
  898. SL R8,TRQBQUE-TRQBLOK(,R1) ... 00901000
  899. SPACE 00902000
  900. ELAPSED EQU * HERE TO CALCULATE ELAPSED TIME IN QUEUE AND PRIORITY 00903000
  901. STCK TEMPSAVE GET CURRENT TIME OF DAY 00904000
  902. BC 3,DOWNWEGO CLOCK NOT FUNCTIONING @VA04301 00904100
  903. LM R0,R1,TEMPSAVE ... 00905000
  904. SLR R1,R7 - VMTODINQ 00906000
  905. BC 8+2+1,*+6 ... 00907000
  906. SLR R0,R15 ... 00908000
  907. SLR R0,R6 ... 00909000
  908. SRDL R0,12 /4096 00910000
  909. SPACE 00911000
  910. AIF (NOT &AP).NOTAP1 HRC066DK 00911100
  911. L R1,PREFIXA -> this CPU prefix HRC066DK 00911200
  912. TM CPSTAT4-PSA(R1),CPSHUT Is system coming down? HRC066DK 00911300
  913. BZ *+6 No HRC066DK 00911400
  914. SR R8,R8 Else ensure no PRG009 HRC066DK 00911500
  915. .NOTAP1 ANOP HRC066DK 00911600
  916. DR R8,R1 EXECUTED/ELAPSED ... 00912000
  917. AH R9,VMQPRIOR + OLD PRIORITY 00913000
  918. SRL R9,1 /2 00914000
  919. STH R9,VMQPRIOR = NEW, SMOOTHED PRIORITY 00915000
  920. BR R14 RETURN TO CALLER @V407577 00916100
  921. SPACE 00916200
  922. INCPROBT DS 0H INCREMENT PROBLEM STATE TIME @VA07582 00916250
  923. CLC VMTMOUTQ,PROBSTRT WAS CALCULATION ALREADY DONE? @VA07582 00916300
  924. BER R14 YES, RETURN TO CALLER @VA07582 00916350
  925. STM R4,R7,TEMPR4 SAVE REGS USED IN SUBROUTINE @VA07582 00916400
  926. LM R4,R5,VMTMOUTQ GET TIMER AT PROBLEM STATE END @VA07582 00916450
  927. LM R6,R7,PROBSTRT GET TIMER AT PROBLEM STATE START @VA07582 00916500
  928. SLR R7,R5 CALC 2ND HALF OF ELAPSED TIME @VA07582 00916550
  929. BNM *+6 WAS THERE A CARRY? @VA07582 00916600
  930. BCTR R6,0 NO CARRY, SIGNIFICANT DIFFERENCE @VA07582 00916650
  931. SLR R6,R4 CALC 1ST HALF OF ELAPSED TIME @VA07582 00916700
  932. LM R4,R5,PROBTIME GET TOTAL PROBLEM TIME @VA07582 00916750
  933. SLR R5,R7 SUBTRCT 2ND HALF OF ELAPSED TIME @VA07582 00916800
  934. BNM *+6 WAS THERE A CARRY? @VA07582 00916850
  935. BCTR R4,0 NO CARRY, SIGNIFICANT DIFFERENCE @VA07582 00916900
  936. SLR R4,R6 SUBTRCT 1ST HALF OF ELAPSED TIME @VA07582 00916950
  937. STM R4,R5,PROBTIME STORE NEW TOTAL PROBLEM TIME @VA07582 00917000
  938. LM R4,R7,TEMPR4 RESTORE REGS USED IN SUBROUTINE @VA07582 00917050
  939. BR R14 RETURN TO CALLER @VA07582 00917100
  940. EJECT 00917150
  941. ARUNLST EQU * ADD A USER TO THE RUNNABLE LIST 00918000
  942. TM VMDSTAT,VMRUN ALL READY IN THE RUNLIST ? @VA04341 00918400
  943. BOR R14 YES - RETURN TO CALLER @VA04341 00918800
  944. LA R2,DMKSCHRL POINT TO LIST 00919000
  945. LH R0,VMQPRIOR ADD IN BLOCKAGE DELAY FACTOR @VA01352 00920000
  946. AL R0,VMEPRIOR TO RESOLVE THE RUNLIST BLOK. @VA01352 00921000
  947. * FAILURE 00922000
  948. ST R0,VMRPRIOR STORE THE DISPATCHING PRIORITY @VA01352 00923000
  949. LOCK OBTAIN,TYPE=RL,SPIN=YES,SAVE LOCK THE RUNLIST @V407577 00923100
  950. L R1,DMKSCHRL GET ADDRESS OF 1ST USER NOW ON LIST 00924000
  951. TM VMQLEVEL,VMHIPRI HIGHEST PRIORITY USER ?? 00925000
  952. BO ADDLISTR ADD TO RUNLIST @VA04341 00926100
  953. SPACE 00927000
  954. ADRLOOP EQU * 00928000
  955. CR R1,R2 END OF LIST ?? 00929000
  956. BE ADDLISTR ADD TO RUNLIST @VA04341 00930100
  957. TM VMQLEVEL-VMBLOK(R1),VMHIPRI 1ST BLOK HIGHEST PRIORITY 00931000
  958. BO ADDNEXT YES -- SKIP IT 00932000
  959. CL R0,VMRPRIOR-VMBLOK(,R1) LOWER PRIORITY ? @VA01352 00933000
  960. BL ADDLISTR ADD TO RUNLIST @VA04341 00934100
  961. ADDNEXT EQU * POINT TO NEXT USER TO TEST 00935000
  962. L R1,VMQFPNT-VMBLOK(,R1) GET ADDRESS OF NEXT BLOK 00936000
  963. B ADRLOOP AND KEEP LOOKING 00937000
  964. SPACE 00938000
  965. ADDLISTR EQU * INSERT VMBLOK INTO RUNLIST @VA04341 00939300
  966. OI VMDSTAT,VMRUN FLAG USER IN RUNNABLE LIST @VA04341 00939600
  967. L R2,VMQBPNT-VMBLOK(,R1) POINT TO PREVIOUS VMBLOK 00941000
  968. STM R1,R2,VMQFPNT CHAIN NEW USER IN HERE 00942000
  969. ST R11,VMQFPNT-VMBLOK(,R2) CHAIN NEW BLOK TO PREVIOUS 00943000
  970. ST R11,VMQBPNT-VMBLOK(,R1) AND TO NEXT 00944000
  971. LOCK RELEASE,TYPE=RL,SPIN=,SAVE @V407577 00944100
  972. BR R14 AND RETURN TO CALLER .. 00945000
  973. ADDLISTE EQU * INSERT VMBLOK INTO ELIGIBLE LIST @V407577 00945100
  974. OI VMDSTAT,VMRUN FLAG USER IN RUNNABLE LIST @V407577 00945200
  975. L R2,VMQBPNT-VMBLOK(,R1) POINT TO PREVIOUS VMBLOK@V407577 00945300
  976. STM R1,R2,VMQFPNT CHAIN NEW USER IN HERE @V407577 00945400
  977. ST R11,VMQFPNT-VMBLOK(,R2) @V407577 00945500
  978. ST R11,VMQBPNT-VMBLOK(,R1) @V407577 00945600
  979. BR R14 AND RETURN TO CALLER .. @V407577 00945700
  980. SPACE 00946000
  981. AWAITLST EQU * ADD A USER TO THE ELIGIBLE LIST 00947000
  982. TM VMDSTAT,VMELIG ALREADY IN THE ELIGIBLE LIST @VA04341 00949000
  983. BOR R14 YES - RETURN TO CALLER @VA04341 00950000
  984. ST R14,TEMPR14 SAVE CALLER'S R14 @V407577 00951100
  985. BAL R14,CALCBIAS CALCULATE ELIGIBLE LIST PRIORITY @V407577 00951200
  986. L R14,TEMPR14 RESTORE CALLER'S R14 @V407577 00951300
  987. LA R2,WAITQ1 POINT TO Q1 ELIGIBLE LIST 00976000
  988. LA R3,DMKSCHW1 AND COUNT 00977000
  989. TM VMQLEVEL,VMQ1 REALLY WAITING FOR Q1 ? 00978000
  990. BO SETPRIOR YES -- GO SET FINAL PRIORITY ... 00979000
  991. LA R2,WAITQ2 POINT TO Q2 ELIGIBLE LIST 00980000
  992. LA R3,DMKSCHW2 AND COUNT 00981000
  993. TM VMQLEVEL,VMDROP1 JUST DROPPED FROM Q1 ? 00982000
  994. BZ SETPRIOR NO -- GO SET PRIORITY 00983000
  995. LH R1,DMKSCHIB GET INTERACTIVE USER BIAS 00984000
  996. SLR R0,R1 AND LOWER PRIORITY 00985000
  997. NI VMQLEVEL,X'FF'-VMDROP1 UNFLAG Q1 DROP 00986000
  998. SETPRIOR ST R0,VMEPRIOR SET ELIGIBLE LIST PRIORITY 00987000
  999. L R1,VMQFPNT-VMBLOK(,R2) POINT TO 1ST BLOK ON LIST 00988000
  1000. LH R4,0(R3) COUNT OF USERS IN LIST 00989000
  1001. A R4,F1 ADD ONE 00990000
  1002. STH R4,0(R3) AND RESTORE 00991000
  1003. OI VMDSTAT,VMELIG SET ELIGIBLE LIST FLAG 00992000
  1004. SCHMN0 MC MNCOAEL,MNCLSCH MONITOR ADD TO ELIG LIST @VM01017 00993000
  1005. TM VMQLEVEL,VMAEX HI PRIORITY Q2 ?? 00994000
  1006. BO ADDLISTE YES - ADD TO TOP OF ELIGIBLE LIST@VA04341 00995100
  1007. SPACE 00996000
  1008. ADQLOOP EQU * 00997000
  1009. CR R1,R2 END OF THE LIST ?? 00998000
  1010. BE ADDLISTE YES - ADD TO ELIGIBLE LIST HERE @VA04341 00999100
  1011. CL R0,VMEPRIOR-VMBLOK(,R1) FOUND A LOWER GUY ? 01000000
  1012. BL ADDLISTE YES - ADD TO ELIGIBLE LIST HERE @VA04341 01001100
  1013. L R1,VMQFPNT-VMBLOK(,R1) KEEP LOOKING 01002000
  1014. B ADQLOOP .. 01003000
  1015. CALCBIAS EQU * ADD A USER TO THE ELIGIBLE LIST @VA04341 01003020
  1016. LH R1,VMWSPROJ GET PROJECTED WORKING SET @VA04341 01003040
  1017. LA R2,100 ... FOR ARITHMETIC @VA04341 01003060
  1018. MR R0,R2 GET SET FOR PERCENTAGE @VA04341 01003080
  1019. L R15,=A(DMKDSPNP) ADDR. OF DYNAMIC PAGE COUNT @VA04341 01003100
  1020. L R15,0(,R15) GET NUMBER OF PAGEABLE PAGES @VA04341 01003120
  1021. LTR R15,R15 CHECK FOR ZERO PAGES @VA04341 01003140
  1022. BZ NODIV1 IF ZERO, SKIP DIVIDE INSTRUCTION.@VA04341 01003160
  1023. DR R0,R15 GET WORKING SET SIZE AS % OF @VA04341 01003180
  1024. * AVAIALBLE 01003200
  1025. NODIV1 MH R1,DMKSCHPB MULTIPLY BY PAGING BIAS FACTOR @VA04341 01003220
  1026. SLR R0,R0 CLEAR WORK REGISTER @VA04341 01003240
  1027. IC R0,VMUPRIOR GET SHEDULING PRIORITY @VA04341 01003260
  1028. MH R0,DMKSCHUB MULTIPLY BY USER PRIORITY BIAS @VA04341 01003280
  1029. ALR R1,R0 ADD TO PAGING BIAS @VA04341 01003300
  1030. LH R2,DMKSCHPB GET PAGING BIAS WEIGHT FACTOR @VA04341 01003320
  1031. AH R2,DMKSCHUB PLUS USER BIAS WEIGHT FACTOR @VA04341 01003340
  1032. BZ GETBASE IF NO BIAS, NO WEIGHT @VA04341 01003360
  1033. SLR R0,R0 CLEAR FOR DIVISION @VA04341 01003380
  1034. DR R0,R2 AND GET WEIGHTED AVERAGE @VA04341 01003400
  1035. SPACE 01003420
  1036. GETBASE STCK TEMPSAVE GET TOD FOR BASE PRIORITY @VA04341 01003440
  1037. BC 3,DOWNWEGO CLOCK NOT FUNCTIONING @VA04301 01003441
  1038. L R0,TEMPSAVE USE HIGH ORDER WORD ONLY @VA04341 01003460
  1039. LH R2,DMKSCHPD GET PAGING DELAY SHIFT @VA04341 01003480
  1040. LA R3,RSHIFT ASSUME RIGHT SHIFT @VA04341 01003500
  1041. LTR R2,R2 + FOR RIGHT SHIFT, - FOR LEFT @VA04341 01003520
  1042. BNM SHIFT ALL SET FOR RIGHT SHIFT @VA04341 01003540
  1043. LA R3,LSHIFT SET FOR LEFT SHIFT @VA04341 01003560
  1044. LPR R2,R2 ... @VA04341 01003580
  1045. SHIFT EX R0,0(,R3) DO PROPER SHIFT @VA04341 01003600
  1046. ALR R0,R1 AND ADD IN BIAS @VA04341 01003620
  1047. BR R14 AND RETURN TO CALLER @V407577 01003650
  1048. SPACE 2 01004000
  1049. DROPLIST EQU * DROP THIS USER FROM THE @VA04341 01005100
  1050. * RUNNABLE/ELIGIBLE LIST. 01005200
  1051. NI VMDSTAT,X'FF'-VMRUN UNFLAG AS IN LIST 01006000
  1052. TM VMDSTAT,VMELIG ARE WE DROPPING HIM FROM ELIGIBLE 01007000
  1053. BZ NODELIG NO, SKIP COUNT DECREMENT 01008000
  1054. LA R1,DMKSCHW2 ADD, OF WAITQ2 COUNT 01009000
  1055. TM VMQLEVEL,VMQ1 IS HE IN Q1 ELIGIBLE LIST? 01010000
  1056. BZ NOQ1 NO, USE R1 AS SETUP 01011000
  1057. LA R1,DMKSCHW1 YES, GET ADD. OF Q1 WAIT COUNT 01012000
  1058. NOQ1 LH R2,0(R1) SUBTRACT 1 FROM COUNT OF 01013000
  1059. S R2,F1 USERS IN ELIGIBLE LIST 01014000
  1060. STH R2,0(R1) 01015000
  1061. NI VMDSTAT,255-VMELIG REMOVE ELIGIBLE LIST FLAG 01016000
  1062. LM R1,R2,VMQFPNT GET CHAIN POINTERS @V407577 01016100
  1063. ST R1,VMQFPNT-VMBLOK(,R2) AND @V407577 01016200
  1064. ST R2,VMQBPNT-VMBLOK(,R1) UNCHAIN @V407577 01016300
  1065. BR R14 EXIT TO CALLER @V407577 01016400
  1066. NODELIG EQU * 01017000
  1067. LOCK OBTAIN,TYPE=RL,SPIN=YES,SAVE LOCK THE RUNLIST @V407577 01017100
  1068. LM R1,R2,VMQFPNT GET CHAIN POINTERS 01018000
  1069. ST R1,VMQFPNT-VMBLOK(,R2) AND 01019000
  1070. ST R2,VMQBPNT-VMBLOK(,R1) UNCHAIN 01020000
  1071. LOCK RELEASE,TYPE=RL,SPIN=,SAVE @V407577 01020100
  1072. BR R14 EXIT TO CALLER 01021000
  1073. SPACE 01022000
  1074. RSHIFT SRL R0,0(R2) EXECUTED TO ALTER BASE PRIORITY 01023000
  1075. LSHIFT SLL R0,0(R2) .... 01024000
  1076. EJECT 01025000
  1077. *. 01026000
  1078. * OPERATION - 01027000
  1079. * 01028000
  1080. * D. REAL TIMER STAMP 01029000
  1081. * 1. CONVERT THE CURRENT TIMER VALUE TO THE APPROPRIATE UNITS; 01030000
  1082. * IE, CONVERT THE LOCATION 80 TIMER TO MICROSECONDS 01031000
  1083. * 2. STORE THE TOD CLOCK, AND ADD TO IT THE VALUE IN THE TIMER 01032000
  1084. * 3. ESTABLISH A TOD CLOCK COMPARATOR REQUEST FOR THE SPECIFIED 01033000
  1085. * INTERVAL 01034000
  1086. *. 01035000
  1087. SPACE 2 01036000
  1088. AIF (&RTIMR EQ 0).RTM2 01037000
  1089. RSTMPON EQU * START UP A REAL INTERVAL TIMER 01038000
  1090. STCK TEMPSAVE GET CURRENT TOD @VA02049 01039000
  1091. BC 3,DOWNWEGO CLOCK NOT FUNCTIONING @VA04301 01039100
  1092. TM VMTLEVEL,VMRON IS THIS A REAL TIMER @VA01688 01040000
  1093. BZ SETCPU NO, STAMP CPU TIMER @VA01688 01041000
  1094. TM VMTLEVEL,VMSTMPI INTERVAL TIMER REQUEST? @VA01688 01042000
  1095. BO SETCPU NO, STAMP CPU TIMER @VA01688 01043000
  1096. OI VMTLEVEL,VMSTMPI FLAG LOCATION 80 TIMER STAMPED 01044000
  1097. SR R0,R0 FOR HIGHORDER REGISTER ADJUST 01045000
  1098. L R1,VMTRQBLK POINT TO TIMER REQUEST BLOK 01046000
  1099. USING TRQBLOK,R1 ADDRESSABILITY 01047000
  1100. LM R4,R5,TEMPSAVE GET CURRENT TOD VALUE @VA02049 01048000
  1101. STM R4,R5,TRQBTOD AND STORE IN TRQBLOK @VA02049 01049000
  1102. SR R4,R4 CLEAR R4 JUST IN CASE @VA02049 01050000
  1103. LCTL C1,C1,VMSEG GET CORRECT STO @VA07222 01051100
  1104. LRA R6,TIMER-PSA VIRT. LOC. 80 AVAILABLE? @VA07222 01051200
  1105. BZ *+8 YES, USE VIRT. LOC. 80 @VA07222 01051300
  1106. LA R6,VMTIMER NO, POINT AT ACTIVE COPY @VA07222 01051400
  1107. L R5,0(,R6) PICK UP TIMER VALUE @VA07222 01051500
  1108. LTR R5,R5 CURRENTLY NEGATIVE ?? 01052000
  1109. BNM CVTMS NO -- 01053000
  1110. SL R5,=XL4'80000000' GET TIME TILL IT WRAPS 01054000
  1111. AL R5,=XL4'7FFFFFFF' GET TIME TILL IT AGAIN GOES NEGATIVE 01055000
  1112. LA R0,13 FOR HIGH ORDER REG ADJUSTMENT @VA01872 01056000
  1113. SPACE 01057000
  1114. CVTMS M R4,=F'13' CONVERT TO MICROSECONDS 01058000
  1115. ALR R4,R0 ADJUST HIGH ORDER REGISTER 01059000
  1116. SLDL R4,12 GET TOD CLOCK UNITS @VA02049 01060000
  1117. AL R5,TRQBTOD+4 GET TOD FOR INTERRUPT 01061000
  1118. BC 12,*+8 .. 01062000
  1119. AL R4,F1 .. 01063000
  1120. AL R4,TRQBTOD .. 01064000
  1121. STM R4,R5,TRQBVAL AND STORE IN TRQBLOK 01065000
  1122. BAL R14,SETIMER GO SET TOD CLOCK COMPARATOR REQUEST 01066000
  1123. SETCPU EQU * @VA01688 01067000
  1124. TM VMPSTAT,VMV370R EC MODE ALLOWED 01068000
  1125. BCR 8,R3 NO -- EXIT 01069000
  1126. TM VMTLEVEL,VMSTMPT CPU TIMER REQUEST? @VA01688 01070000
  1127. BOR R3 NO, EXIT @VA01688 01071000
  1128. OI VMTLEVEL,VMSTMPT FLAG CPU TIMER STAMPED 01072000
  1129. L R2,VMECEXT POINT TO EXTENDED CONTROL BLOK 01073000
  1130. L R1,EXTCPTRQ-ECBLOK(,R2) GET TRQBLOK FOR CPU TIMER 01074000
  1131. LM R4,R5,TEMPSAVE GET CURRENT TOD VALUE @VA02049 01075000
  1132. STM R4,R5,TRQBTOD AND STORE IN TRQBLOK @VA02049 01076000
  1133. LM R6,R7,EXTCPTMR-ECBLOK(R2) GET CPUTIMER VALUE @VA02049 01077000
  1134. TM VMTLEVEL,VMCPUTMR DOES USER CPU TIMER = REAL @VA02049 01078000
  1135. * TIMER? 01079000
  1136. BZ ADDCPTOD NO, GO ADD TO T-O-D VALUE @VA02049 01080000
  1137. LM R4,R5,VMTMOUTQ GET TIME LEFT IN QUEUE @VA04063 01081100
  1138. LTR R4,R4 HAS IT GONE NEGATIVE? @VA04063 01081200
  1139. BNM *+8 NO....OK TO USE @VA04063 01081300
  1140. LM R4,R5,ZEROES CAN'T USE NEGATIVE NUMBER @VA04063 01081400
  1141. SLR R7,R5 FIGURE DIFFERENCE BETWEEN @VA04063 01081500
  1142. BC 11,*+6 ORIGINAL CPUTIMER VALUE @VA04063 01081600
  1143. BCTR R6,0 AND CURRENT VALUE @VA04063 01081700
  1144. SLR R6,R4 @VA04063 01081800
  1145. LTR R6,R6 IF EXTCPTMR IS NEGATIVE @VA07016 01081830
  1146. BM ECVALNEG LEAVE TRQBQUE AS IS @VA07016 01081860
  1147. LM R4,R5,TRQBQUE GET ORIGINAL TIME SLICE VALUE @VA04063 01081900
  1148. SLR R5,R7 DECREMENT THIS VALUE @VA04063 01082000
  1149. BC 11,*+6 BY THE CALCULATED @VA04063 01082100
  1150. BCTR R4,0 DIFFERENCE (AMOUNT USED UP) @VA04063 01082200
  1151. SLR R4,R6 @VA04063 01082300
  1152. STM R4,R5,TRQBQUE UPDATE T/S TO CURRENT VALUE @VA04063 01082400
  1153. ECVALNEG EQU * @VA07016 01082450
  1154. LM R4,R5,TRQBTOD GET CURRENT T-O-D AGAIN @VA04063 01082500
  1155. LM R6,R7,VMTMOUTQ NOW, GET TIME LEFT IN QUEUE @VA04063 01082600
  1156. STM R6,R7,EXTCPTMR-ECBLOK(R2) UPDATE CPUTIMER VALUE @VA02049 01083000
  1157. LTR R6,R6 HAS IT GONE NEGATIVE? @VA02049 01084000
  1158. BNM ADDCPTOD NO, GO ADD IT TO T-O-D VALUE @VA02049 01085000
  1159. B SETCOMP SET UP FOR TIMER INTERRUPT @VA02049 01086000
  1160. ADDCPTOD EQU * @VA02049 01087000
  1161. LA R8,1 CONSTANT 01088000
  1162. ALR R5,R7 GET TIME 01089000
  1163. BC 12,*+6 FOR CPU TIMER INTERRUPT 01090000
  1164. ALR R4,R8 .. 01091000
  1165. ALR R4,R6 .. 01092000
  1166. BC 12,*+8 BRANCH IF NO OVERFLOW 01093000
  1167. L R4,FFS LARGE NUMBER IF TIMER WRAPS 01094000
  1168. SETCOMP EQU * @VA02049 01095000
  1169. STM R4,R5,TRQBVAL SET VALUE FOR CLOCK COMPARATOR 01096000
  1170. BAL R14,SETIMER AND GO SET TIMER REQUEST 01097000
  1171. BR R3 RETURN TO CALLER @V200820 01098000
  1172. EJECT 01099000
  1173. *. 01100000
  1174. * OPERATION - 01101000
  1175. * 01102000
  1176. * E. REAL TIMER UNSTAMP 01103000
  1177. * 1. RESET THE PENDING TRQBLOK REQUEST 01104000
  1178. * 2. CALCULATE THE ELAPSED TIME SPENT IN USER-REQUESTED WAIT 01105000
  1179. * STATE AND SUBTRACT IT FROM THE APPROPRIATE TIMER 01106000
  1180. * 3. IF THE TIMER HAS GONE NEGATIVE, POST A PENDING INTERRUPT 01107000
  1181. *. 01108000
  1182. SPACE 2 01109000
  1183. RSTMPOFF EQU * STOP A RUNNING REAL TIMER -- 01110000
  1184. STCK TEMPSAVE SAVE TOD CLOCK @VA01553 01111000
  1185. BC 3,DOWNWEGO CLOCK NOT FUNCTIONING @VA04301 01111100
  1186. TM VMTLEVEL,VMSTMPI LOCATION 80 TIMER STAMPED ? 01112000
  1187. BZ CPTOFF NO -- GO UNSTAMP CPU TIMER 01113000
  1188. NI VMTLEVEL,255-VMSTMPI UNSTAMP INTERVAL TIMER @V200820 01114000
  1189. L R1,VMTRQBLK POINT TO TIMER REQUEST BLOK 01115000
  1190. BAL R14,RESETIMR AND GO CANCEL TIMER REQUEST 01116000
  1191. LM R4,R5,TRQBTOD GET TOD AT REQUEST 01117000
  1192. LM R0,R1,TEMPSAVE GET TOD NOW 01118000
  1193. SPACE 01119000
  1194. SLR R1,R5 GET ELAPSED TIME 01120000
  1195. BC 11,*+6 ... 01121000
  1196. BCTR R0,R0 ... @VA01553 01122000
  1197. SLR R0,R4 ... 01123000
  1198. SRDL R0,12 CONVERT TO MICROSECONDS 01124000
  1199. * R6 POINTS TO ACTIVE VIRT. LOC. 80 TIMER @VA07222 01124100
  1200. LCTL C1,C1,VMSEG GET CORRECT STO @VA07222 01124200
  1201. LRA R6,TIMER-PSA VIRT. LOC. 80 AVAILABLE? @VA07222 01124300
  1202. BZ *+8 YES, USE VIRT. LOC. 80 @VA07222 01124400
  1203. LA R6,VMTIMER NO, POINT AT ACTIVE COPY @VA07222 01124500
  1204. LTR R0,R0 IS IT A BIG NUMBER? @VA02792 01125000
  1205. BZ NORMAL NO...REGULAR ROUTINE WILL DO @VA02792 01126000
  1206. D R0,=F'3328' CONVERT TO 3.3MS UNITS @VA02792 01127000
  1207. SLL R1,8 SHIFT TO BIT POS. 23 @VA02792 01128000
  1208. L R2,0(,R6) PICK UP TIMER VALUE @VA07222 01129100
  1209. LTR R2,R2 SET COND. CODE IF NEG @VA03848 01130000
  1210. BNM MAYHAP NOT NEG. NOW...BUT MAY GO NEG. @VA03848 01130100
  1211. SLR R2,R1 SUBTR. FROM INTV. TIMER @VA03848 01130200
  1212. ST R2,0(,R6) SAVE INTERIM VALUE @VA07222 01130310
  1213. LTR R5,R0 SAVE REMAINDER IN R5 (IF ANY) @VA03848 01130400
  1214. BZ NOINT IF NO REMAINDER...EXIT @VA03848 01130500
  1215. B DOREST OTHERWISE DO THE REST OF IT @VA03848 01130600
  1216. MAYHAP SLR R2,R1 SUBTR. FROM INTV. TIMER @VA03848 01130700
  1217. LTR R2,R2 SET COND CODE IF NEG. NOW @VA03848 01130800
  1218. ST R2,0(,R6) SAVE INTERIM VALUE @VA07222 01131100
  1219. LR R5,R0 SAVE REMAINDER IN REG 5 @VA02792 01132000
  1220. BC 11,*+8 NO INTERRUPT JUST YET @VA02792 01133000
  1221. BAL R9,INTINT SET INTERVAL TIMER INTERRUPT @VA02792 01134000
  1222. LTR R5,R5 ANY REMAINDER? @VA02792 01135000
  1223. BZ NOINT NO, ALL SET @VA02792 01136000
  1224. DOREST EQU * @VA03848 01136500
  1225. LR R1,R5 REMAINDER INTO REG 1 @VA02792 01137000
  1226. SLR R0,R0 CLEAR REG 0 @VA02792 01138000
  1227. NORMAL EQU * AND CONTINUE @VA02792 01139000
  1228. D R0,=F'13' CONVERT TO TIMER UNITS 01140000
  1229. L R2,0(,R6) GET VIRTUAL TIMER VALUE @VA07222 01141100
  1230. LTR R2,R2 SET COND. CODE IF NEGATIVE @VA03848 01142100
  1231. BNM MAYBE NOT NEG. NOW....BUT MAY GO NEG. @VA03848 01142200
  1232. SLR R2,R1 SUBTR. FROM INTV. TIMER @VA03848 01142300
  1233. ST R2,0(,R6) STORE VIRTUAL TIMER VALUE @VA07222 01142410
  1234. B NOINT NO INTERRUPT THIS TIME @VA03848 01142500
  1235. MAYBE SLR R2,R1 SUBTR. FROM INTV. TIMER @VA03848 01142600
  1236. LTR R2,R2 SET COND. CODE IF NEG. NOW @VA03848 01142700
  1237. ST R2,0(,R6) STORE VIRTUAL TIMER VALUE @VA07222 01143100
  1238. BC 11,NOINT NO INTERRUPT 01144000
  1239. BAL R9,INTINT SET INTERVAL TIMER INTERRUPT @V200198 01145000
  1240. NOINT EQU * 01146000
  1241. TM VMPSTAT,VMV370R EC MODE ALLOWED @VA0861 01147000
  1242. BCR 8,R3 NO -- EXIT 01148000
  1243. TM VMTLEVEL,VMSTMPT CPU TIMER STAMPED ? 01149000
  1244. BCR 8,R3 NO -- EXIT 01150000
  1245. CPTOFF EQU * 01151000
  1246. NI VMTLEVEL,X'FF'-VMSTMPT UNFLAG CPU TIMER STAMP 01152000
  1247. L R2,VMECEXT GET EXTENDED CONTROL BLOK 01153000
  1248. L R1,EXTCPTRQ-ECBLOK(,R2) POINT TO TRQBLOK 01154000
  1249. BAL R14,RESETIMR AND CANCEL TIMER REQUEST 01155000
  1250. LM R4,R5,TRQBTOD GET TOD AT TIMER REQUEST 01156000
  1251. LM R0,R1,TEMPSAVE AND CURRENT TOD 01157000
  1252. SLR R1,R5 GET ELAPSED TIME 01158000
  1253. BC 11,*+6 ... 01159000
  1254. BCTR R0,R0 ... @VA01553 01160000
  1255. SLR R0,R4 ... 01161000
  1256. LM R4,R5,EXTCPTMR-ECBLOK(R2) GET CPU TIMER 01162000
  1257. SLR R5,R1 GET NEW TIMER VALUE 01163000
  1258. BC 11,*+6 ... 01164000
  1259. BCTR R4,R0 ... @VA01553 01165000
  1260. SLR R4,R0 ... 01166000
  1261. TM VMTLEVEL,VMCPUTMR TRACKING VIRTUAL IN REAL? @VA04063 01166050
  1262. BNO EXIT NO - JUST SAVE IT FOR LATER @VA04063 01166100
  1263. STM R4,R5,VMTMOUTQ @VA10081 01166125
  1264. LTR R4,R4 HAS IT GONE NEGATIVE? @VA04063 01166150
  1265. BNM EXIT NO - OK TO SAVE @VA04063 01166200
  1266. NI VMTLEVEL,X'FF'-VMCPUTMR NO LONGER TRACKING @VA04063 01166250
  1267. L R2,VMECEXT POINT TO ECBLOK @VA04063 01166300
  1268. L R1,EXTCPTRQ-ECBLOK(,R2) POINT TO TRQBLOK AGAIN @VA04063 01166350
  1269. LM R0,R1,TRQBQUE PUT CURRENT TIME SLICE... @VA04063 01166400
  1270. STM R0,R1,VMTMOUTQ ...VALUE BACK @VA04063 01166450
  1271. STM R4,R5,EXTCPTMR-ECBLOK(R2) SAVE TIMER IN ECBLOK @VA04063 01166500
  1272. L R7,=X'10500000' CPU TIMER COLLATING VALUE @VA04063 01166550
  1273. L R8,=X'10050400' CPU TIMER INTERRUPT CODE @VA04063 01166600
  1274. BAL R9,CPTINT SET CPU TIMER INTERRUPT @VA04063 01166650
  1275. BR R3 EXIT @VA04063 01166700
  1276. EXIT EQU * @VA04063 01166750
  1277. STM R4,R5,EXTCPTMR-ECBLOK(R2) AND SAVE IN ECBLOK 01167000
  1278. BR R3 AND EXIT @V200820 01168000
  1279. EJECT 01169000
  1280. *. 01170000
  1281. * OPERATION - 01171000
  1282. * 01172000
  1283. * F. INTERRUPT PROCESSING FOR REAL TIMERS 01173000
  1284. * 1. FOR THE REAL LOCATION 80 TIMER, SET A VALUE OF -1 INTO 01174000
  1285. * THE USER'S VIRTUAL TIMER SLOT IN THE VMBLOK, POST A PENDING 01175000
  1286. * EXTERNAL INTERRUPT, AND EXIT 01176000
  1287. * 2. FOR THE REAL CPU TIMER, ADD THE ELAPSED TIME TO THE CURRENT 01177000
  1288. * VALUE OF THE TIMER AND TEST THE SIGN. IF IT IS NEGATIVE, 01178000
  1289. * FLAG A CPU TIMER INTERRUPT PENDING AND EXIT. IF 01179000
  1290. * IT IS POSITIVE, UNFLAG ANY PENDING INTERRUPT AND EXIT. 01180000
  1291. *. 01181000
  1292. SPACE 2 01182000
  1293. DMKSCH80 EQU * IRA FOR REAL TIMER INTERRUPT 01183000
  1294. USING *,R12 TEMPORARY ADDRESSABILITY 01184000
  1295. DROP R13 @V407577 01185100
  1296. LM R12,R13,ASCHDL MAIN ROUTINE BASE REG @V407577 01185200
  1297. USING DMKSCHDL,R12,R13 ADDRESSABILITY @V407577 01185300
  1298. BAL R9,INTINT SET INTERVAL TIMER INTERRUPT @V200198 01187000
  1299. SR R0,R0 GET TIMER VALUE 01188000
  1300. BCTR R0,0 OF -1 01189000
  1301. * R2 POINTS TO ACTIVE VIRTUAL LOC. 80 TIMER 01190100
  1302. LCTL C1,C1,VMSEG CORRECT ST0 @VA06414 01190200
  1303. LRA R2,TIMER-PSA VIRTUAL TIMER LOCATION? @VA06414 01190300
  1304. BZ *+8 OK @VA06414 01190400
  1305. LA R2,VMTIMER NOT THERE, USE ALTERNATE @VA06414 01190500
  1306. ST R0,0(,R2) SET NEW VALUE @VA06414 01190600
  1307. NI VMTLEVEL,X'FF'-VMSTMPI UNSTAMP LOC. 80 TIMER 01191000
  1308. GOTO DMKDSPCH AND TO RE-DISPATCH 01195000
  1309. EJECT 01195050
  1310. DMKSCHAE EQU * IRA FOR FAVORED PERCENTAGE USER @VA04341 01195100
  1311. USING *,R12 TEMPORARY ADDRESSABILITY @VA04341 01195150
  1312. DROP R13 @V407577 01195210
  1313. LM R12,R13,ASCHDL MAIN ROUTINE BASE REG @V407577 01195220
  1314. USING DMKSCHDL,R12,R13 ADDRESSABILITY @V407577 01195230
  1315. XC SCHBVAL,SCHBVAL DON'T FOUL UP QUEUE DROP LOGIC @VA04341 01195300
  1316. BAL R14,DROPLIST DROP FROM RUNNABLE LIST @VA05536 01195350
  1317. TM VMDSTAT,VMINQ USER IN A QUEUE ?? @VA05536 01195355
  1318. BZ GOTODSP NO, DON'T TRY TO DROP @VA05536 01195360
  1319. BAL R14,DROPQ DROP USER FROM ACTIVE QUEUE @VA05536 01195365
  1320. CL R11,AVMREAL THIS USER VIRT=REAL ?? @VA05536 01195370
  1321. BE GOTODSP YES, NO NEED TO FLUSH @VA05536 01195375
  1322. L R1,=A(DMKPTRUC) FLUSHED PAGE COUNT @VA08286 01195380
  1323. L R2,DMKSCHN1 USER IN Q1 @VA08286 01195385
  1324. A R2,DMKSCHN2 PLUS Q2 @VA08286 01195390
  1325. C R2,0(R1) BELOW THESHOLD @VA08286 01195395
  1326. BNH GOTODSP NO NEED TO FLUSH @VA08286 01195400
  1327. L R15,=A(DMKPTRRS) RESET PAGES @V408246 01195410
  1328. BALR R14,R15 @V408246 01195420
  1329. GOTODSP GOTO DMKDSPCH LET DSP CALL THE BOSS @VA05206 01195460
  1330. * AGAIN 01195500
  1331. EJECT 01196000
  1332. DMKSCHCP EQU * IRA FOR CPU TIMER INTERRUPTS 01197000
  1333. USING *,R12 TEMPORARY ADDRESSABILITY 01198000
  1334. DROP R13 @V407577 01199100
  1335. LM R12,R13,ASCHDL MAIN ROUTINE BASE REG @V407577 01199200
  1336. USING DMKSCHDL,R12,R13 ADDRESSABILITY @V407577 01199300
  1337. NI VMTLEVEL,X'FF'-VMSTMPT UNFLAG CPU TIMER STAMP 01201000
  1338. STCK TEMPSAVE SAVE TOD CLOCK 01202000
  1339. BC 3,DOWNWEGO CLOCK NOT FUNCTIONING @VA04301 01202100
  1340. L R2,VMECEXT POINT TO EXTENDED CONTROL BLOK 01203000
  1341. L R1,EXTCPTRQ-ECBLOK(,R2) POINT TO TIMER REQUEST BLOK 01204000
  1342. LM R4,R5,TRQBTOD GET TOD AT REQUEST 01205000
  1343. LM R0,R1,TEMPSAVE GET TOD NOW 01206000
  1344. LA R6,1 01207000
  1345. SLR R1,R5 GET ELAPSED TIME 01208000
  1346. BC 11,*+6 .. 01209000
  1347. SLR R0,R6 .. 01210000
  1348. SLR R0,R4 .. 01211000
  1349. SPACE 01212000
  1350. LM R4,R5,EXTCPTMR-ECBLOK(R2) GET CPU TIMER 01213000
  1351. SLR R5,R1 GET NEW TIMER VALUE 01214000
  1352. BC 11,*+6 .. 01215000
  1353. SLR R4,R6 .. 01216000
  1354. SLR R4,R0 .. 01217000
  1355. STM R4,R5,EXTCPTMR-ECBLOK(R2) AND SAVE IT 01218000
  1356. LTR R4,R4 IS TIMER NEGATIVE ?? 01219000
  1357. L R7,=X'10500000' GET CPU TIMER COLLATING VALUE @V200198 01220000
  1358. BM CPTPEND @V200198 01221000
  1359. LA R1,VMPXINT @V200198 01222000
  1360. CPTLOOP LR R2,R1 @V200198 01223000
  1361. L R1,XINTNEXT-XINTBLOK(,R2) @V200198 01224000
  1362. LTR R1,R1 @V200198 01225000
  1363. BZ CPTLEND @V200198 01226000
  1364. C R7,XINTSORT-XINTBLOK(,R1) @V200198 01227000
  1365. BH CPTLOOP @V200198 01228000
  1366. BL CPTLEND @V200198 01229000
  1367. L R0,XINTNEXT-XINTBLOK(,R1) @V200198 01230000
  1368. ST R0,XINTNEXT-XINTBLOK(,R2) @V200198 01231000
  1369. LA R0,XINTSIZE @V200198 01232000
  1370. CALL DMKFRET @V200198 01233000
  1371. B CPTLEND @V200198 01234000
  1372. CPTPEND L R8,=X'10050400' CPU TIMER INTERRUPT CODE @V200198 01235000
  1373. BAL R9,CPTINT SET CPU TIMER INTERRUPT @V200198 01236000
  1374. TM VMTLEVEL,VMCPUTMR TRACKING VIRTUAL IN REAL? @VA04063 01236100
  1375. BNO CPTLEND NO...GO TO DISPATCH @VA04063 01236200
  1376. NI VMTLEVEL,X'FF'-VMCPUTMR NO LONGER TRACKING @VA04063 01236300
  1377. L R2,VMECEXT POINT TO ECBLOK @VA04063 01236400
  1378. L R1,EXTCPTRQ-ECBLOK(,R2) POINT TO TRQBLOK AGAIN @VA04063 01236500
  1379. LM R7,R8,TRQBQUE PUT CURRENT TIME SLICE... @VA04063 01236600
  1380. STM R7,R8,VMTMOUTQ ...VALUE BACK @VA04063 01236700
  1381. CPTLEND GOTO DMKDSPCH GO TO DISPATCH @V200198 01237000
  1382. SPACE 1 01238000
  1383. INTINT SLR R7,R7 ZERO @V200198 01239000
  1384. L R8,=X'00800080' @V200198 01240000
  1385. CPTINT LA R2,VMPXINT @V200198 01241000
  1386. INTLOOP LR R4,R2 @V200198 01242000
  1387. L R2,XINTNEXT-XINTBLOK(,R4) @V200198 01243000
  1388. LTR R2,R2 @V200198 01244000
  1389. BZ INTADD @V200198 01245000
  1390. C R7,XINTSORT-XINTBLOK(,R2) @V200198 01246000
  1391. BH INTLOOP @V200198 01247000
  1392. BL INTADD @V200198 01248000
  1393. O R8,XINTCODE-XINTBLOK(,R2) @V200198 01249000
  1394. ST R8,XINTCODE-XINTBLOK(,R2) @V200198 01250000
  1395. BR R9 @V200198 01251000
  1396. INTADD LA R0,XINTSIZE @V200198 01252000
  1397. CALL DMKFREE @V200198 01253000
  1398. ST R1,XINTNEXT-XINTBLOK(,R4) @V200198 01254000
  1399. ST R2,XINTNEXT-XINTBLOK(,R1) @V200198 01255000
  1400. ST R7,XINTSORT-XINTBLOK(,R1) @V200198 01256000
  1401. ST R8,XINTCODE-XINTBLOK(,R1) @V200198 01257000
  1402. SLR R0,R0 @V200198 01258000
  1403. ST R0,XINTPARM-XINTBLOK(,R1) @V200198 01259000
  1404. BR R9 @V200198 01260000
  1405. .RTM2 ANOP 01261000
  1406. EJECT 01262000
  1407. DMKSCHST EQU * HERE TO SET TIMER REQUEST FROM OUTSIDE DMKSCHDL 01263000
  1408. USING *,R15 TEMPORARY ADDRESSABILITY 01264000
  1409. STM R0,R15,BALRSAVE SAVE CALLER'S REGISTERS 01265000
  1410. DROP R13 @V407577 01266100
  1411. LM R12,R13,ASCHDL MAIN ROUTINE BASE REG @V407577 01266200
  1412. USING DMKSCHDL,R12,R13 ADDRESSABILITY @V407577 01266300
  1413. DROP R15 01268000
  1414. BAL R14,SETIMER GO SET TIMER 01269000
  1415. LM R0,R15,BALRSAVE RESTORE REGISTERS 01270000
  1416. BR R14 AND EXIT 01271000
  1417. SPACE 3 01272000
  1418. DMKSCHRT EQU * HERE TO RESET TIMER FROM OUTSIDE DMKSCHDL 01273000
  1419. USING *,R15 TEMPORARY ADDRESSABILITY 01274000
  1420. STM R0,R15,BALRSAVE SAVE ALL REGISTERS 01275000
  1421. DROP R13 @V407577 01276100
  1422. LM R12,R13,ASCHDL MAIN ROUTINE BASE REG @V407577 01276200
  1423. USING DMKSCHDL,R12,R13 ADDRESSABILITY @V407577 01276300
  1424. DROP R15 01278000
  1425. BAL R14,RESETIMR GO RESET REQUEST 01279000
  1426. LM R0,R15,BALRSAVE RESTORE REGISTERS 01280000
  1427. BR R14 AND EXIT 01281000
  1428. SPACE 2 01282000
  1429. DMKSCHMD EQU * HERE AT MIDNIGHT TO CHANGE THE CLOCK 01283000
  1430. USING *,R12 TEMPORARY ADDRESSABILITY 01284000
  1431. DROP R13 @V407577 01285100
  1432. LM R12,R13,ASCHDL MAIN ROUTINE BASE REG @V407577 01285200
  1433. USING DMKSCHDL,R12,R13 ADDRESSABILITY @V407577 01285300
  1434. CALL DMKMIDNT CALL DATE CHANGE ROUTINE 01287000
  1435. GOTO DMKDSPCH AND LEAVE 01288000
  1436. EJECT 01289000
  1437. *. 01290000
  1438. * OPERATION - 01291000
  1439. * 01292000
  1440. * G. TIMER REQUEST QUEUE MAINTENANCE 01293000
  1441. * 1. TO ESTABLISH A TOD CLOCK INTERRUPT REQUEST, CHAIN DOWN THE 01294000
  1442. * LIST OF PENDING REQUESTS UNTIL A TRQBLOK FOR A REQUEST WITH 01295000
  1443. * A CLOCK VALUE GREATER THAN OR EQUAL TO THE CURRENT ONE IS 01296000
  1444. * FOUND. WHEN IT IS, INSERT THE NEW REQUEST INTO THE CHAIN 01297000
  1445. * AHEAD OF IT. IF THE NEW REQUEST IS THE FIRST ONE IN THE 01298000
  1446. * CHAIN, ISSUE A SET CLOCK COMPARATOR INSTRUCTION FOR THE 01299000
  1447. * VALUE IN THE TRQBLOK 01300000
  1448. * 2. TO RESET A REQUEST, REMOVE THE TRQBLOK FROM THE CHAIN. IF 01301000
  1449. * THE BLOCK REMOVED WAS THE 1ST ONE, ISSUE A SET CLOCK COMP- 01302000
  1450. * ARATOR INSTRUCTION FOR THE VALUE IN THE FOLLOWING BLOCK 01303000
  1451. *. 01304000
  1452. SPACE 2 01305000
  1453. SETIMER EQU * HERE TO ESTABLISH A CLOCK COMPARATOR REQUEST 01306000
  1454. SPACE 01307000
  1455. STM R0,R3,TEMPSAVE+32 SAVE THESE REGISTERS 01308000
  1456. LA R0,DMKSCHTQ POINT TO QUEUE OF OUTSTANDING REQUESTS 01309000
  1457. LR R2,R0 SAVE ADDRESS 01310000
  1458. LOCK OBTAIN,TYPE=TR,SPIN=YES,SAVE LOCK THE TRQ CHAIN @V407577 01310100
  1459. SPACE 01311000
  1460. TIMELOOP L R2,TRQBFPNT-TRQBLOK(,R2) POINT TO NEXT BLOK ON LIST 01312000
  1461. CLC TRQBVAL,TRQBVAL-TRQBLOK(R2) IS NEW REQUEST SHORTER ?? 01313000
  1462. BH TIMELOOP NO -- 01314000
  1463. BL QTIME YES - QUEUE IN FRONT @VA06136 01314100
  1464. CR R2,R0 IS IT THE END OF QUEUE ?? @VA06136 01314200
  1465. BNE TIMELOOP NO - KEEP SEARCHING @VA06136 01314300
  1466. SPACE 01315000
  1467. QTIME L R3,TRQBBPNT-TRQBLOK(,R2) GET BACKCHAIN POINTER 01316000
  1468. STM R2,R3,TRQBFPNT AND CHAIN IN NEW REQUEST 01317000
  1469. ST R1,TRQBFPNT-TRQBLOK(,R3) TO PREVIOUS 01318000
  1470. ST R1,TRQBBPNT-TRQBLOK(,R2) AND NEXT BLOK 01319000
  1471. SPACE 01320000
  1472. CR R3,R0 FIRST BLOK 01321000
  1473. BE SETCKC YES, SET NEW REQUEST @V407577 01322100
  1474. TM APSTAT1,APUOPER RUNNING AN AP SYSTEM @V407577 01322200
  1475. BNO TIMEXIT NO, NO NEED TO CHECK FURTHER @V407577 01322300
  1476. L R3,PREFIXB POINT TO OTHER PREFIX @V407577 01322400
  1477. B FINDTRQ GO SCAN FOR NEW ACTIVE TRQ @V407577 01322500
  1478. SPACE 01323000
  1479. SETCKC SCKC TRQBVAL YES -- SET NEW COMPARATOR REQUEST 01324000
  1480. ST R1,ACTIVTRQ INDICATE THE ACTIVE TRQ IN PSA @V407577 01324100
  1481. SPACE 01325000
  1482. TIMEXIT LOCK RELEASE,TYPE=TR,SPIN=,SAVE @V407577 01326100
  1483. LM R0,R3,TEMPSAVE+32 RESTORE REGISTERS @V407577 01326200
  1484. BR R14 AND EXIT 01327000
  1485. SPACE 2 01328000
  1486. RESETIMR EQU * RESET A CLOCK COMPARATOR REQUEST 01329000
  1487. TM APSTAT1,APUOPER RUNNING AN AP SYSTEM? @V407577 01329100
  1488. BO MPRESET YES, SPECIAL HANDLING REQUIRED @V407577 01329200
  1489. SPACE 01330000
  1490. STM R0,R3,TEMPSAVE+32 SAVE THESE REGISTERS 01331000
  1491. LA R0,DMKSCHTQ POINT TO QUEUE OF REQUESTS 01332000
  1492. LM R2,R3,TRQBFPNT GET CHAIN POINTERS 01333000
  1493. ST R2,TRQBFPNT-TRQBLOK(,R3) UNCHAIN THIS BLOK 01334000
  1494. ST R3,TRQBBPNT-TRQBLOK(,R2) -- 01335000
  1495. CR R3,R0 UNCHAINING THE 1ST BLOK ?? 01336000
  1496. BNE TIMEXIT NO -- 01337000
  1497. LR R1,R2 POINT TO NEW 1ST BLOK 01338000
  1498. B SETCKC AND GO ESTABLISH REQUEST 01339000
  1499. MPRESET EQU * CLOCK COMPARATOR RESET FOR AP SYSTEMS @V407577 01339010
  1500. STM R0,R3,TEMPSAVE+32 SAVE THESE WORK REGISTERS @V407577 01339020
  1501. LA R0,DMKSCHTQ PICK UP POINTER TO TRQ ANCHOR @V407577 01339030
  1502. LOCK OBTAIN,TYPE=TR,SPIN=YES,SAVE AND LOCK THE CHAIN@V407577 01339040
  1503. LR R2,R0 @V407577 01339050
  1504. TRQSCAN L R2,TRQBFPNT-TRQBLOK(,R2) POINT TO NEXT TRQBLOK @V407577 01339060
  1505. CR R2,R0 BACK TO THE ANCHOR? @V407577 01339070
  1506. BE LOCKDSQ YES, THE TRQBLOK MUST BE ON @V407577 01339080
  1507. * THE DISPATCHER QUEUE 01339090
  1508. CR R2,R1 IS THIS THE TRQBLOK BEING RESET? @V407577 01339100
  1509. BE UNCHAIN YES, GO UNCHAIN IT @V407577 01339110
  1510. B TRQSCAN CONTINUE THE SEARCH @V407577 01339120
  1511. LOCKDSQ LOCK OBTAIN,TYPE=DS,SPIN=YES,SAVE LOCK THE QUEUE @V407577 01339130
  1512. LM R2,R3,TRQBFPNT GET CHAIN POINTERS @V407577 01339140
  1513. ST R2,TRQBFPNT-TRQBLOK(,R3) UNCHAIN THIS BLOK @V407577 01339150
  1514. ST R3,TRQBBPNT-TRQBLOK(,R2) -- @V407577 01339160
  1515. LH R2,VMSTKCNT PICK UP COUNT OF STACKED BLOCKS @V407577 01339170
  1516. BCTR R2,0 AND DECREMENT BY ONE @V407577 01339180
  1517. STH R2,VMSTKCNT AND SAVE IT AWAY @V407577 01339190
  1518. LOCK RELEASE,TYPE=DS,SPIN=,SAVE @V407577 01339200
  1519. B TIMEXIT EXIT...COMPARATOR IS ALREADY SET @V407577 01339210
  1520. UNCHAIN LM R2,R3,TRQBFPNT GET CHAIN POINTERS @V407577 01339220
  1521. ST R2,TRQBFPNT-TRQBLOK(,R3) UNCHAIN THIS BLOK @V407577 01339230
  1522. ST R3,TRQBBPNT-TRQBLOK(,R2) -- @V407577 01339240
  1523. SETACTIV L R3,PREFIXB POINT TO THE OTHER PSA AREA @V407577 01339250
  1524. L R2,ACTIVTRQ-PSA(,R3) POINTER TO ACTIVE TRQBLOK@V407577 01339260
  1525. CR R1,R2 IS THIS TRQBLOK ACTIVE ON THE @V407577 01339270
  1526. * OTHER PROCESSOR? 01339280
  1527. BNE NOCLEAR NO, NO NEED TO CLEAR THE POINTER @V407577 01339290
  1528. SR R0,R0 CLEAR FOR THE STORE @V407577 01339300
  1529. ST R0,ACTIVTRQ-PSA(,R3) ZIP IT OUT @V407577 01339310
  1530. NOCLEAR L R2,ACTIVTRQ IS THE RESET TRQBLOK ACTIVE @V407577 01339320
  1531. CR R1,R2 ....ON THIS PROCESSOR? @V407577 01339330
  1532. BNE TIMEXIT NO, THEN EXIT @V407577 01339340
  1533. FINDTRQ LA R0,DMKSCHTQ POINTER TO THE TRQBLOK ANCHOR @V407577 01339350
  1534. LR R2,R0 SET UP FOR THE SCAN LOOP @V407577 01339360
  1535. NEXTTRQ L R2,TRQBFPNT-TRQBLOK(,R2) POINT TO NEXT TRQBLOK @V407577 01339370
  1536. CR R2,R0 ARE WE BACK TO THE ANCHOR? @V407577 01339380
  1537. BE GOSET YES, SET THE DISTANT FUTURE @V407577 01339390
  1538. C R2,ACTIVTRQ-PSA(,R3) IS THIS TRQBLOK ALREADY @V407577 01339400
  1539. * ACTIVE ON THE OTHER PROCESSOR? 01339410
  1540. BE NEXTTRQ YES, CONTINUE THE SCAN @V407577 01339420
  1541. GOSET LR R1,R2 SETCKC WANTS THE POINTER IN R1 @V407577 01339430
  1542. B SETCKC AND GO SET IT @V407577 01339440
  1543. EJECT 01340000
  1544. *. 01341000
  1545. * OPERATION - 01342000
  1546. * 01343000
  1547. * H. CPU UTILIZATION MAINTENANCE 01344000
  1548. * 1. USING SAME TIMER REQUEST BLOCK AS CAUSED CONTROL TO BE 01345000
  1549. * BROUGHT HERE (INITIATED BY DMKCPI), REESTABLISH NEXT TIMER 01346000
  1550. * INTERRUPT 30 SECONDS FROM NOW BY CALLING DMKSCHST. 01347000
  1551. * 2. CALCULATE TOTAL WAIT TIME IN 30 SECOND INTERVAL SINCE LAST 01348000
  1552. * TIME THROUGH THIS ROUTINE AND UPDATE SMOOTHED VALUE OF WAIT 01349000
  1553. * IN DMKSCHCU FIELD. 01350000
  1554. *. 01351000
  1555. DMKSCHTI EQU * @V2B2638 01352000
  1556. USING PSA,R0 LOW CORE ADDRESSABILITY @V2B2638 01353000
  1557. USING TRQBLOK,R10 TIMER REQUEST BLOC ADDRESSABILITY@V2B2638 01354000
  1558. USING *,R12 @V2B2638 01355000
  1559. DROP R13 @V407577 01357100
  1560. LM R12,R13,ASCHDL MAIN ROUTINE BASE REG @V407577 01357200
  1561. USING DMKSCHDL,R12,R13 ADDRESSABILITY @V407577 01357300
  1562. L R2,PREFIXB GET PREFIX VALUE OF OTHER PROC @V4M0102 01357310
  1563. TM CPSTATUS-PSA(R2),CPWAIT IS OTHER PROC IN WAIT? @V4M0102 01357410
  1564. BNO SETTRQ NO, GO SET NEXT TRQ @V4M0102 01357510
  1565. TM CPSTATUS-PSA(R2),CPSUPER IS OTHER PROC IN @V4M0102 01357610
  1566. * SUPERVISOR STATE? @V4M0102 01357710
  1567. BO SETTRQ YES, GO SET NEXT TRQ @V4M0102 01357810
  1568. SIGNAL WAKEUP WAKE UP IDLE PROCESSOR @V4M0102 01357910
  1569. SETTRQ DS 0H @V4M0102 01358010
  1570. LR R1,R10 SET ADDR OF TRQ FOR DMKSCHST @V4M0102 01358110
  1571. STCK TRQBTOD GET PRESENT TOD @V2B2638 01359000
  1572. BC 3,DOWNWEGO CLOCK NOT FUNCTIONING @VA04301 01359100
  1573. L R5,DMKSCHLI SAMPLE INTERVAL IN SECONDS @V2B2638 01360000
  1574. SR R4,R4 ZIP @V2B2638 01361000
  1575. M R4,=F'1000000' CONVERT TO MICRO SECS @V2B2638 01362000
  1576. SLDL R4,12 ALIGN TO TOD FORMAT @V2B2638 01363000
  1577. AL R5,TRQBTOD+4 ADD IN TOD LOW ORDER BITS @V2B2638 01364000
  1578. BC 12,*+8 SKIP IF NO OVERFLOW @V2B2638 01365000
  1579. AL R4,F1 ADD ONE SEC IF OVERFLOW @V2B2638 01366000
  1580. AL R4,TRQBTOD ADD IN HIGH ORDER TOD BITS @V2B2638 01367000
  1581. STM R4,R5,TRQBVAL NEXT INTERRUPT DUE AT THIS TIME @V2B2638 01368000
  1582. CALL DMKSCHST TICK...TOCK...TICK @V2B2638 01369000
  1583. SR R2,R2 ZIP @V2B2638 01370000
  1584. SR R1,R1 CLEAR FOR A CONSTANT INDEX @V407577 01370100
  1585. TM APSTAT1,PROCIPL IS THIS THE IPL'ED PROCESSOR? @VMV0008 01370240
  1586. BO CALCWAIT YES, UPDATE THE CPU'S VALUES @V407577 01370300
  1587. PREFIX L R2,PREFIXB POINT TO THE OTHER PSA @V407577 01370400
  1588. CALCWAIT LM R4,R5,IDLEWAIT-PSA(R2) GET INTERVAL IDLE TIME @V407577 01371100
  1589. SLDL R4,2 TO WITHIN 4.8% OF NEAREST 1/4 SEC@V407577 01371200
  1590. L R5,OLDWAIT(R1) PREVIOUS CHECKPOINT @V407577 01371300
  1591. ST R4,OLDWAIT(R1) NEW CHECKPOINT @V407577 01371400
  1592. SR R5,R4 @V407577 01371500
  1593. LM R6,R7,IONTWAIT-PSA(R2) COMPUTE INTERVAL IOWAIT @V407577 01371600
  1594. SLDL R6,2 TO WITHIN 4.8% OF NEAREST 1/4 SEC@V407577 01371700
  1595. L R7,OLDIOWT(R1) @V407577 01371800
  1596. ST R6,OLDIOWT(R1) @V407577 01371900
  1597. SR R7,R6 @V407577 01372000
  1598. LM R8,R9,PAGEWAIT-PSA(R2) COMPUTE INTERVAL PGWAIT @V407577 01372100
  1599. SLDL R8,2 WITHIN 4.8% OF NEAREST 1/4 SEC @V407577 01372200
  1600. L R9,OLDPWT(R1) @V407577 01372300
  1601. ST R8,OLDPWT(R1) @V407577 01372400
  1602. SR R9,R8 @V2B2638 01385000
  1603. AR R5,R7 COMPUTE TOTAL INTERVAL WAIT @V2B2638 01386000
  1604. AR R5,R9 @V2B2638 01387000
  1605. LR R3,R5 @V2B2638 01388000
  1606. SR R4,R4 @V2B2638 01389000
  1607. D R4,=F'21' ADD 4.8% TO CORRECT ERROR @V2B2638 01390000
  1608. C R4,F10 IS REMAINDER SIGNIFICANT @V2B2638 01391000
  1609. BNH NOFIXUP NO, NO CORRECTION TO MAKE @V2B2638 01392000
  1610. LA R5,1(,R5) YES, ADD 1 TO 4.8% VALUE @V2B2638 01393000
  1611. NOFIXUP AR R3,R5 NOW TO NEAREST 1/4 SEC @V2B2638 01394000
  1612. L R7,DMKSCHCU(R1) SMOOTH WAIT VALUE..TO 1/4 SEC @V407577 01395100
  1613. SR R6,R6 @V2B2638 01396000
  1614. M R6,F3 @V2B2638 01397000
  1615. ALR R3,R7 TOTAL NEW VALUE @V2B2638 01398000
  1616. SRL R3,2 (NEW + 3OLD)/4 @V2B2638 01399000
  1617. ST R3,DMKSCHCU(R1) SAVE NEW VALUE @V407577 01400050
  1618. TM APSTAT1,APUOPER RUNNING AN AP SYSTEM? @V407577 01400100
  1619. BNO OUT NO, ALL DONE @V407577 01400150
  1620. C R1,F16 ARE THE APU'S VALUES UPDATED? @V407577 01400200
  1621. BE OUT YES, ALL FINISHED @V407577 01400250
  1622. L R1,F16 BUMP THE INDEX TO POINT TO THE @V407577 01400300
  1623. * ATTACHED PROCESSOR VALUES 01400350
  1624. SR R2,R2 CLEAR THE PSA INDEX @V407577 01400400
  1625. TM APSTAT1,PROCIPL IS THIS THE IPL'ED PROCESSOR? @VMV0008 01400460
  1626. BO PREFIX YES, GO POINT TO APU PSA AREA @V407577 01400500
  1627. B CALCWAIT THIS PROCESSOR IS THE APU @V407577 01400550
  1628. OUT GOTO DMKDSPCH @V2B2638 01401000
  1629. EJECT 01402000
  1630. * CONSTANTS, QUEUE ANCHORS, ETC.. 01403000
  1631. * 01404000
  1632. ASCHDL DC A(DMKSCHDL,DMKSCHDL+4096) @V407577 01404100
  1633. DMKSCHS1 DC F'0' SMOOTHED COUNT OF Q1 USERS*1024 @V2B2638 01407000
  1634. DMKSCHS2 DC F'0' SMOOTHED COUNT OF Q2 USERS*1024 @V2B2638 01408000
  1635. DMKSCHCO DC F'0' SMOOTHED CORE UTILIZATION * 1024 @V2B2638 01409000
  1636. DMKSCHSC DC F'1024' SMOOTHED S. C. RATIO * 1024 @V2B2638 01410000
  1637. * 01410100
  1638. * THE FOLLOWING EIGHT WAIT SAVE AREAS MUST BE CONTIGUOUS 01410200
  1639. * 01410300
  1640. DMKSCHCU DC F'120' SMOOTHED WAIT TIME VALUE TO 1/4 @V407577 01410400
  1641. * SEC ( CPU VALUE ) 01410500
  1642. OLDWAIT DC X'FFFFFFFF' WORK AREA @V2B2638 01411000
  1643. OLDIOWT DC X'FFFFFFFF' INITIAL VALUE OF I/OWAIT @V2B2638 01412000
  1644. OLDPWT DC X'FFFFFFFF' INITIAL VALUE OF PAGE WAIT @V2B2638 01413000
  1645. DMKSCHCA DC F'120' SMOOTHED WAIT TIME VALUE TO 1/4 @V407577 01413100
  1646. * SEC ( APU VALUE ) 01413200
  1647. OLDWAITA DC X'FFFFFFFF' WORK AREA (APU ) @V407577 01413300
  1648. OLDIOWTA DC X'FFFFFFFF' INITIAL VALUE OF I/OWAIT (APU) @V407577 01413400
  1649. OLDPWTA DC X'FFFFFFFF' INITIAL VALUE OF PAGE WAIT (APU) @V407577 01413500
  1650. DMKSCHLI DC F'30' WAIT TIME SAMPLING INTERVAL IN @V2B2638 01414000
  1651. * SECS 01415000
  1652. * 01416000
  1653. SPACE 2 01417000
  1654. DMKSCHTQ DS 0D DUMMY TIMER REQUEST BLOK 01418000
  1655. DC 2F'-1' LARGE REQUEST IF QUEUE EMPTY 01419000
  1656. DC 2A(DMKSCHTQ) REQUEST QUEUE ANCHOR 01420000
  1657. SPACE 2 01421000
  1658. DMKSCHRL DC 2A(DMKSCHRL) LIST OF DISPATCHABLE VMBLOKS 01422000
  1659. DMKSCHEL EQU * ENTRY POINT FOR CPINIT AUTOLOG @V305535 01423000
  1660. SPACE 01424000
  1661. WAITQ1 DC 2A(WAITQ1) LIST OF VMBLOKS WAITING FOR Q1 01425000
  1662. SPACE 01426000
  1663. WAITQ2 DC 2A(WAITQ2) LIST OF VMBLOKS WAITING FOR Q2 01427000
  1664. DMKSCHW1 DC H'0' COUNT OF USERS ELIGIBLE FOR Q1 01428000
  1665. DMKSCHW2 DC H'0' COUNT OF USERS ELIGIBLE FOR Q2 01429000
  1666. SPACE 2 01430000
  1667. DMKSCHQ1 EQU * 01431000
  1668. QUEUE1 DC F'0' .2 SECOND USER IS ALLOWED TO 01432000
  1669. DC X'30D40000' STAY IN QUEUE 1. 01433000
  1670. DMKSCHN1 DC F'0' Q1 COUNT 01434000
  1671. SPACE 01435000
  1672. DMKSCHQ2 EQU * 01436000
  1673. QUEUE2 DC X'00000001' 2.0 SECONDS USER IS ALLOWED TO 01437000
  1674. DC X'E8480000' STAY IN QUEUE 2. 01438000
  1675. DMKSCHN2 DC F'0' Q2 COUNT 01439000
  1676. SPACE 2 01440000
  1677. PAGUSAGE DC F'0' SUM OF ACTIVE WORKING SETS 01441000
  1678. SPACE 01442000
  1679. ENTRY DMKSCHPU ENTRY FOR MEASUREMENT 01443000
  1680. DMKSCHPU EQU PAGUSAGE 01444000
  1681. SPACE 2 01445000
  1682. DMKSCHPG DC F'16' ALLOWABLE PAGING OVERHEAD 01446000
  1683. SPACE 01447000
  1684. ENTRY DMKSCHPB,DMKSCHUB,DMKSCHIB,DMKSCHPD 01448000
  1685. DMKSCHPB DC H'0' PAGING BIAS WEIGHT FACTOR 01449000
  1686. DMKSCHUB DC H'1' USER PRIORITY BIAS WEIGHT FACTOR 01450000
  1687. DMKSCHIB DC H'0' INTERACTIVE USER BIAS 01451000
  1688. DMKSCHPD DC H'0' PAGING DELAY SHIFT 01452000
  1689. SPACE 2 01453000
  1690. * ASSURED EXECUTION USER CONTROL 01454000
  1691. SPACE 01455000
  1692. DMKSCHAP DC 4D'0' CHANGED BY DMKCFS (SET FAVORED) @VA04341 01456100
  1693. AEXPQUE1 EQU DMKSCHAP QUE 1 FAVORED PERCENTAGE @VA04341 01456200
  1694. AEXPQUE2 EQU DMKSCHAP+16 QUE 2 FAVORED PERCENTAGE @VA04341 01456300
  1695. SPACE 01457000
  1696. DMKSCHAU DC A(0) A(VMBLOK) OF ASSURED PERCENTAGE USER 01458000
  1697. SPACE 01459000
  1698. * 01460050
  1699. * THE FOLLOWING FIELDS ARE DEPENDENT AND MUST NOT BE 01460100
  1700. * ORDERED IN AND WAY. 01460150
  1701. * 01460200
  1702. SCHBLOK DS 0D ALIGNMENT @VA04341 01460250
  1703. DMKSCHBK EQU * ENTRY POINT FOR DMKTMRPT @VA05288 01460275
  1704. SCHBVAL DC D'0' TOD CLOCK COMPARATOR VALUE FOR @VA04341 01460300
  1705. * INTERRUPT 01460350
  1706. SCHBFPNT DC F'0' FORWARD POINTER (NOT USED) @VA04341 01460400
  1707. SCHBBPNT DC F'0' BACKWARD POINTER (NOT USED) @VA04341 01460450
  1708. SCHBAEXP DC D'0' 'VMHIPRI' TIME SLICE VALUE @VA04341 01460500
  1709. SCHBUSER DC F'0' ADDRESS OF VMBLOK FOR FAVORED @VA04341 01460550
  1710. * USER 01460600
  1711. SCHBIRA DC A(DMKSCHAE) INTERRUPT RETURN FROM CLOCK COMP.@VA04341 01460650
  1712. SCHBQUE DC D'0' NOT USED @VA04341 01460700
  1713. SPACE 1 01460750
  1714. DMKSCHAL DC X'00' QUEUE DROP FLAG FOR MONITOR 01461000
  1715. * 01462000
  1716. * BIT DEFINED IN 'DMKSCHAL' 01463000
  1717. TSEND EQU X'20' USER VOLUNTARILY DROPPED FROM Q2 @V2B2638 01464000
  1718. * 01465000
  1719. EJECT 01466000
  1720. * QUEUE CONTROL BLOK DSECT 01467000
  1721. SPACE 01468000
  1722. VMQBLOK DSECT 01469000
  1723. VMQTIME DS D TIME-IN-Q, DOUBLE PRECISION 2'S COMPLEMENT TOD UNITS 01470000
  1724. VMQNUM DS F NUMBER OF USERS IN THIS QUEUE 01471000
  1725. SPACE 2 01472000
  1726. CPAUTEL EQU X'80' AUTOLOGGED ELIGIBLE USERS READY @V305535 01473000
  1727. EJECT 01474000
  1728. PSA 01475000
  1729. Q1DROP EQU X'40' 01476000
  1730. COPY VMBLOK 01477000
  1731. COPY XINTBLOK @V200198 01478000
  1732. COPY TIMER 01479000
  1733. COPY CORE 01480000
  1734. COPY EQU 01481000
  1735. END 01482000