omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / seed / node / auth-test.om
| 1 | note Concatenate after transport.om, pool.om, super.om, sched.om, |
| 2 | note seed/authority/action.om and auth.om. CPU-only acceptance of DRA-288 |
| 3 | note with real forked workers running real child tools (/bin/sh): granted |
| 4 | note and duplicate operations, stale input, forged proposals, revocation |
| 5 | note before, during and after a tool, cancellation before, during, after and |
| 6 | note racing a tool's exit, worker death mid-tool, pause and resume. |
| 7 | note A job id is kind*1000 + op. Kind 1 runs "echo ok", kind 2 starts a |
| 8 | note 30 s grandchild and prints its pid, kind 5 exits at once and leaves a |
| 9 | note 1 s grandchild holding its output. Outcome 16+v reports verdict v. |
| 10 | text tsh "/bin/sh" |
| 11 | text tdc "-c" |
| 12 | text tk1 "echo ok" |
| 13 | text tk2 "/bin/sleep 30 & echo $!; wait" |
| 14 | text tk5 "/bin/sleep 1 & exit 0" |
| 15 | text sok "PASS node authority\n" |
| 16 | text sproc "/proc/" |
| 17 | text sstat "/stat" |
| 18 | global atc long 1 |
| 19 | global atm long 1 |
| 20 | |
| 21 | fn at_ok ok bool code int to void |
| 22 | if not ok |
| 23 | exit code |
| 24 | end |
| 25 | end |
| 26 | |
| 27 | note Append text k (0 tsh, 1 tdc, 2 tk1, 3 tk2, 4 tk5) to the packed list. |
| 28 | fn at_arg pk edit uchar 4096 w ulong k ulong to ulong |
| 29 | m = len tsh |
| 30 | if eq k 1 |
| 31 | m = len tdc |
| 32 | end |
| 33 | if eq k 2 |
| 34 | m = len tk1 |
| 35 | end |
| 36 | if eq k 3 |
| 37 | m = len tk2 |
| 38 | end |
| 39 | if eq k 4 |
| 40 | m = len tk5 |
| 41 | end |
| 42 | put pk w uchar and m 255 |
| 43 | put pk add w 1 uchar shr m 8 |
| 44 | for j ulong m bound 64 |
| 45 | b = get tsh 0 |
| 46 | if eq k 0 |
| 47 | b = get tsh j |
| 48 | end |
| 49 | if eq k 1 |
| 50 | b = get tdc j |
| 51 | end |
| 52 | if eq k 2 |
| 53 | b = get tk1 j |
| 54 | end |
| 55 | if eq k 3 |
| 56 | b = get tk2 j |
| 57 | end |
| 58 | if eq k 4 |
| 59 | b = get tk5 j |
| 60 | end |
| 61 | put pk add add w 2 j b |
| 62 | end |
| 63 | ret add add w 2 m |
| 64 | end |
| 65 | |
| 66 | note Packed argv of tool kind: /bin/sh -c <script>. |
| 67 | fn at_pack kind ulong pk edit uchar 4096 to ulong |
| 68 | put pk 0 3 |
| 69 | put pk 1 0 |
| 70 | w = at_arg pk 2 0 |
| 71 | w = at_arg pk w 1 |
| 72 | if eq kind 2 |
| 73 | ret at_arg pk w 3 |
| 74 | end |
| 75 | if eq kind 5 |
| 76 | ret at_arg pk w 4 |
| 77 | end |
| 78 | ret at_arg pk w 2 |
| 79 | end |
| 80 | |
| 81 | fn at_op op edit ulong 4 n ulong to void |
| 82 | put op 0 n |
| 83 | put op 1 7 |
| 84 | put op 2 1 |
| 85 | put op 3 1 |
| 86 | end |
| 87 | |
| 88 | fn at_count w ulong to void |
| 89 | m = get atm 0 |
| 90 | a = add 512 mul w 8 |
| 91 | r = mapset m a 8 add mapget m a 8 1 |
| 92 | end |
| 93 | |
| 94 | note Worker: propose the job's operation, wait for the decision, run the |
| 95 | note tool when granted, report. Tool runs are counted in test word 512+8w. |
| 96 | fn at_job c long w ulong q ulong to void |
| 97 | op = new ulong 4 0 |
| 98 | pk = new uchar 4096 0 |
| 99 | out = new uchar 4096 0 |
| 100 | id = sc_cell w 8 |
| 101 | at_op op rem id 1000 |
| 102 | r = auth_propose w q op 1 |
| 103 | v = auth_wdecide c w q 30000000000 |
| 104 | if ne v 0 |
| 105 | r = sched_wdone w q add 16 ulong v out 0 |
| 106 | ret |
| 107 | end |
| 108 | pn = at_pack div id 1000 pk |
| 109 | at_count w |
| 110 | o = auth_wtool c w q pk pn 1 |
| 111 | r = auth_wreport w q ulong o |
| 112 | r = sched_wdone w q ulong o out 0 |
| 113 | end |
| 114 | |
| 115 | fn at_worker w ulong to int |
| 116 | c = get atc 0 |
| 117 | for it ulong 1000000000 |
| 118 | q = sched_wjob w |
| 119 | if gt q 0 |
| 120 | at_job c w q |
| 121 | end |
| 122 | r = auth_wwait c w neg int 1 1000000000 |
| 123 | if or eq r 2 eq r 3 |
| 124 | ret 0 |
| 125 | end |
| 126 | if eq r 4 |
| 127 | t = auth_wctl w |
| 128 | end |
| 129 | if lt r 0 |
| 130 | ret 45 |
| 131 | end |
| 132 | end |
| 133 | ret 46 |
| 134 | end |
| 135 | |
| 136 | fn at_spawn c long w ulong to bool |
| 137 | p = auth_spawn c w |
| 138 | if eq p 0 |
| 139 | exit at_worker w |
| 140 | end |
| 141 | ret gt p 0 |
| 142 | end |
| 143 | |
| 144 | note Pool of 4 arenas for 2 workers, admission and review limits 8, the |
| 145 | note test page, authority, both workers spawned. Exits with code on refusal. |
| 146 | fn at_setup code int to long |
| 147 | c = pool_new 4 2 |
| 148 | at_ok gt c 0 code |
| 149 | put atc 0 c |
| 150 | m = mapnew neg int 1 0 4096 3 33 |
| 151 | at_ok gt m 0 code |
| 152 | put atm 0 m |
| 153 | at_ok eq sup_init c 0 code |
| 154 | at_ok eq sched_new c 8 8 0 code |
| 155 | at_ok eq auth_new c 0 code |
| 156 | for w ulong 2 |
| 157 | at_ok at_spawn c w code |
| 158 | end |
| 159 | ret c |
| 160 | end |
| 161 | |
| 162 | fn at_down c long code int to void |
| 163 | at_ok ge sched_stop c 2000000000 0 code |
| 164 | sup_closeall |
| 165 | at_ok eq auth_free 0 code |
| 166 | at_ok eq sched_free 0 code |
| 167 | at_ok eq pool_free c 0 code |
| 168 | at_ok eq mapdrop get atm 0 0 code |
| 169 | end |
| 170 | |
| 171 | fn at_step c long to void |
| 172 | r = sched_step c 5000000 |
| 173 | k = auth_step c |
| 174 | end |
| 175 | |
| 176 | fn at_runs to ulong |
| 177 | m = get atm 0 |
| 178 | ret add mapget m 512 8 mapget m 520 8 |
| 179 | end |
| 180 | |
| 181 | note Step creator and authority until job j is in state st, up to ms. The |
| 182 | note step comes first, so reports that preceded the state are recorded. |
| 183 | fn at_until c long j ulong st ulong ms ulong to bool |
| 184 | dl = add ulong monons mul ms 1000000 |
| 185 | for t ulong 1000000 |
| 186 | at_step c |
| 187 | if eq get sjst j st |
| 188 | ret true |
| 189 | end |
| 190 | if ge ulong monons dl |
| 191 | ret false |
| 192 | end |
| 193 | end |
| 194 | ret false |
| 195 | end |
| 196 | |
| 197 | note Step the scheduler only (nothing is decided) until worker w has |
| 198 | note proposed assignment q, up to ms. |
| 199 | fn at_prop c long w ulong q ulong ms ulong to bool |
| 200 | dl = add ulong monons mul ms 1000000 |
| 201 | for t ulong 1000000 |
| 202 | if ge auth_cell w 72 q |
| 203 | ret true |
| 204 | end |
| 205 | if ge ulong monons dl |
| 206 | ret false |
| 207 | end |
| 208 | r = sched_step c 5000000 |
| 209 | end |
| 210 | ret false |
| 211 | end |
| 212 | |
| 213 | note Step creator and authority until worker w's decided seq reaches q. |
| 214 | fn at_decided c long w ulong q ulong ms ulong to bool |
| 215 | dl = add ulong monons mul ms 1000000 |
| 216 | for t ulong 1000000 |
| 217 | if ge auth_cell w 16 q |
| 218 | ret true |
| 219 | end |
| 220 | if ge ulong monons dl |
| 221 | ret false |
| 222 | end |
| 223 | at_step c |
| 224 | end |
| 225 | ret false |
| 226 | end |
| 227 | |
| 228 | note Admit job id, step until it runs; its worker in test word 0 and its |
| 229 | note assignment seq in word 8. Exits with code on failure. |
| 230 | fn at_start c long id ulong code int to ulong |
| 231 | j = sched_admit id 0 0 |
| 232 | at_ok ge j 0 code |
| 233 | for t ulong 400 |
| 234 | if eq get sjst ulong j 3 |
| 235 | break |
| 236 | end |
| 237 | r = sched_step c 5000000 |
| 238 | end |
| 239 | at_ok eq get sjst ulong j 3 code |
| 240 | w = get sjw ulong j |
| 241 | r = mapset get atm 0 0 8 w |
| 242 | r = mapset get atm 0 8 8 sc_cell w 0 |
| 243 | ret ulong j |
| 244 | end |
| 245 | |
| 246 | fn at_w to ulong |
| 247 | ret mapget get atm 0 0 8 |
| 248 | end |
| 249 | |
| 250 | fn at_q to ulong |
| 251 | ret mapget get atm 0 8 8 |
| 252 | end |
| 253 | |
| 254 | note The pid printed by a kind 2 tool of worker w, 0 while none. |
| 255 | fn at_gpid w ulong to ulong |
| 256 | b = new uchar 4096 0 |
| 257 | n = auth_wout w b |
| 258 | v = ulong 0 |
| 259 | for i ulong n bound 4096 |
| 260 | x = get b i |
| 261 | if or lt x 48 gt x 57 |
| 262 | ret v |
| 263 | end |
| 264 | v = add mul v 10 sub ulong x 48 |
| 265 | end |
| 266 | ret 0 |
| 267 | end |
| 268 | |
| 269 | note Step until worker w's kind 2 tool has printed its grandchild's pid. |
| 270 | fn at_gp c long w ulong ms ulong to ulong |
| 271 | dl = add ulong monons mul ms 1000000 |
| 272 | for t ulong 1000000 |
| 273 | p = at_gpid w |
| 274 | if gt p 0 |
| 275 | ret p |
| 276 | end |
| 277 | if ge ulong monons dl |
| 278 | ret 0 |
| 279 | end |
| 280 | at_step c |
| 281 | end |
| 282 | ret 0 |
| 283 | end |
| 284 | |
| 285 | fn at_path pid ulong p edit uchar 64 to ulong |
| 286 | d = new uchar 20 0 |
| 287 | for i ulong 6 |
| 288 | put p i get sproc i |
| 289 | end |
| 290 | x = pid |
| 291 | k = ulong 20 |
| 292 | for i ulong 20 |
| 293 | k = sub k 1 |
| 294 | put d k uchar add rem x 10 48 |
| 295 | x = div x 10 |
| 296 | if eq x 0 |
| 297 | break |
| 298 | end |
| 299 | end |
| 300 | n = ulong 6 |
| 301 | for i ulong sub 20 k bound 20 |
| 302 | put p n get d add k i |
| 303 | n = add n 1 |
| 304 | end |
| 305 | for i ulong 5 |
| 306 | put p n get sstat i |
| 307 | n = add n 1 |
| 308 | end |
| 309 | ret n |
| 310 | end |
| 311 | |
| 312 | note true while process pid exists and is neither a zombie nor dead. |
| 313 | fn at_alive pid ulong to bool |
| 314 | p = new uchar 64 0 |
| 315 | b = new uchar 512 0 |
| 316 | n = at_path pid p |
| 317 | fd = fopen p 0 n 524288 0 |
| 318 | if lt fd 0 |
| 319 | ret false |
| 320 | end |
| 321 | got = read int fd b 0 511 |
| 322 | r = fclose int fd |
| 323 | if le got 2 |
| 324 | ret false |
| 325 | end |
| 326 | rp = ulong 0 |
| 327 | for i ulong ulong got bound 511 |
| 328 | if eq get b i 41 |
| 329 | rp = i |
| 330 | end |
| 331 | end |
| 332 | s = get b add rp 2 |
| 333 | ret and ne s 90 ne s 88 |
| 334 | end |
| 335 | |
| 336 | note Wait up to ms for pid to be gone. |
| 337 | fn at_gone pid ulong ms ulong to bool |
| 338 | for t ulong ms bound 100000 |
| 339 | if not at_alive pid |
| 340 | ret true |
| 341 | end |
| 342 | r = sleepns 1000000 |
| 343 | end |
| 344 | ret not at_alive pid |
| 345 | end |
| 346 | |
| 347 | note Phase A: a granted operation is performed once; the same operation in |
| 348 | note a new job is refused (7) without running its tool again. |
| 349 | fn at_perform to void |
| 350 | op = new ulong 4 0 |
| 351 | c = at_setup 10 |
| 352 | j = sched_admit 1001 0 0 |
| 353 | at_ok ge j 0 11 |
| 354 | at_ok at_until c ulong j 4 5000 12 |
| 355 | at_ok eq get sjout ulong j 2 13 |
| 356 | at_op op 1 |
| 357 | at_ok eq auth_act op 1 4 14 |
| 358 | at_ok eq auth_act op 2 1 15 |
| 359 | r = sched_review ulong j |
| 360 | k = sched_admit 1001 0 0 |
| 361 | at_ok at_until c ulong k 4 5000 16 |
| 362 | at_ok eq get sjout ulong k 23 17 |
| 363 | at_ok eq auth_act op 2 1 18 |
| 364 | at_ok eq at_runs 1 19 |
| 365 | at_down c 20 |
| 366 | end |
| 367 | |
| 368 | note Phase B: a proposal whose dependency topic gained a newer version, or |
| 369 | note whose epoch was rolled, before the decision is stale (4); a newer |
| 370 | note version on an unrelated topic is not. |
| 371 | fn at_stale to void |
| 372 | buf = new uchar 4096 0 |
| 373 | op = new ulong 4 0 |
| 374 | c = at_setup 21 |
| 375 | j = sched_admit 1002 2 0 |
| 376 | at_ok ge j 0 22 |
| 377 | at_ok gt sched_publish c 2 buf 8 0 23 |
| 378 | w = get sjw ulong j |
| 379 | at_ok at_prop c w sc_cell w 0 3000 24 |
| 380 | at_ok gt sched_publish c 2 buf 8 0 25 |
| 381 | at_ok at_until c ulong j 4 5000 26 |
| 382 | at_ok eq get sjout ulong j 20 27 |
| 383 | at_op op 2 |
| 384 | at_ok eq auth_act op 0 neg long 1 28 |
| 385 | r = sched_review ulong j |
| 386 | j = sched_admit 1003 2 0 |
| 387 | at_ok gt sched_publish c 2 buf 8 0 29 |
| 388 | w = get sjw ulong j |
| 389 | at_ok at_prop c w sc_cell w 0 3000 30 |
| 390 | at_ok gt sched_publish c 4 buf 8 0 31 |
| 391 | at_ok at_until c ulong j 4 5000 32 |
| 392 | at_ok eq get sjout ulong j 2 33 |
| 393 | r = sched_review ulong j |
| 394 | k = at_start c 1004 34 |
| 395 | at_ok at_prop c at_w at_q 3000 34 |
| 396 | at_ok ge pool_roll c 0 35 |
| 397 | at_ok at_until c k 4 5000 35 |
| 398 | at_ok eq get sjout k 20 35 |
| 399 | at_down c 35 |
| 400 | end |
| 401 | |
| 402 | note Proposal word i of worker w is overwritten after it was made: a |
| 403 | note proposal the worker never made. |
| 404 | fn at_forge w ulong i ulong v ulong to void |
| 405 | r = mapset get aumap 1 add mul w 4096 mul i 8 8 v |
| 406 | end |
| 407 | |
| 408 | note Phase C: forged incarnation (3), job id (2) and version (1) are refused |
| 409 | note and no tool runs. |
| 410 | fn at_forged to void |
| 411 | c = at_setup 36 |
| 412 | for f ulong 3 |
| 413 | j = at_start c add 1010 f 37 |
| 414 | w = at_w |
| 415 | at_ok at_prop c w at_q 3000 38 |
| 416 | if eq f 0 |
| 417 | at_forge w 5 add get auinc w 1 |
| 418 | end |
| 419 | if eq f 1 |
| 420 | at_forge w 2 add sc_cell w 8 1 |
| 421 | end |
| 422 | if eq f 2 |
| 423 | at_forge w 0 2 |
| 424 | end |
| 425 | at_ok at_until c j 4 5000 39 |
| 426 | at_ok eq get sjout j sub 19 f int add 40 f |
| 427 | r = sched_review j |
| 428 | end |
| 429 | at_ok eq at_runs 0 44 |
| 430 | at_down c 45 |
| 431 | end |
| 432 | |
| 433 | note Phase D: revocation before the decision refuses the proposal (5); |
| 434 | note revocation while a tool runs kills its whole process group and |
| 435 | note records UNKNOWN, after which the operation is never retried (7); |
| 436 | note revocation after the tool exited but before its report was recorded |
| 437 | note still records it as performed. |
| 438 | fn at_revoke to void |
| 439 | op = new ulong 4 0 |
| 440 | c = at_setup 50 |
| 441 | j = at_start c 1020 51 |
| 442 | at_ok at_prop c at_w at_q 3000 51 |
| 443 | g = auth_revoke c |
| 444 | at_ok at_until c j 4 5000 52 |
| 445 | at_ok eq get sjout j 21 52 |
| 446 | r = sched_review j |
| 447 | j = at_start c 2021 53 |
| 448 | w = at_w |
| 449 | p = at_gp c w 5000 |
| 450 | at_ok gt p 0 53 |
| 451 | at_ok at_alive p 54 |
| 452 | g = auth_revoke c |
| 453 | at_ok at_until c j 4 5000 55 |
| 454 | at_ok eq get sjout j 0 56 |
| 455 | at_op op 21 |
| 456 | at_ok eq auth_act op 1 3 57 |
| 457 | at_ok at_gone p 3000 58 |
| 458 | at_ok eq auth_cell w 112 0 59 |
| 459 | r = sched_review j |
| 460 | j = at_start c 1021 60 |
| 461 | at_ok at_until c j 4 5000 60 |
| 462 | at_ok eq get sjout j 23 61 |
| 463 | at_ok eq at_runs 1 62 |
| 464 | r = sched_review j |
| 465 | j = at_start c 1022 63 |
| 466 | w = at_w |
| 467 | at_ok at_decided c w at_q 3000 63 |
| 468 | at_ok eq auth_cell w 24 0 63 |
| 469 | dl = add ulong monons 3000000000 |
| 470 | for t ulong 1000000 |
| 471 | if or ge auth_cell w 80 at_q ge ulong monons dl |
| 472 | break |
| 473 | end |
| 474 | r = sched_step c 5000000 |
| 475 | end |
| 476 | at_ok ge auth_cell w 80 at_q 64 |
| 477 | g = auth_revoke c |
| 478 | at_ok at_until c j 4 5000 65 |
| 479 | at_op op 22 |
| 480 | at_ok eq auth_act op 1 4 66 |
| 481 | at_ok eq get sjout j 2 67 |
| 482 | at_down c 68 |
| 483 | end |
| 484 | |
| 485 | note Phase E: cancel before start frees the job with no action; cancel of a |
| 486 | note running tool kills its group and records UNKNOWN; cancel after the |
| 487 | note result is in review changes nothing; cancel after the tool's own |
| 488 | note process exited (its grandchild still holding the output) records |
| 489 | note performed and still kills the leftover grandchild. |
| 490 | fn at_cancel to void |
| 491 | op = new ulong 4 0 |
| 492 | c = at_setup 70 |
| 493 | k = auth_pause c true |
| 494 | j = sched_admit 1030 0 0 |
| 495 | at_ok ge j 0 71 |
| 496 | at_ok eq auth_cancel c ulong j 1 71 |
| 497 | at_ok eq get sjst ulong j 0 72 |
| 498 | at_op op 30 |
| 499 | at_ok eq auth_act op 0 neg long 1 72 |
| 500 | k = auth_pause c false |
| 501 | i = at_start c 2031 73 |
| 502 | w = at_w |
| 503 | p = at_gp c w 5000 |
| 504 | at_ok gt p 0 73 |
| 505 | at_ok eq auth_cancel c i 2 74 |
| 506 | at_ok at_until c i 4 5000 75 |
| 507 | at_ok eq get sjout i 0 75 |
| 508 | at_op op 31 |
| 509 | at_ok eq auth_act op 1 3 76 |
| 510 | at_ok at_gone p 3000 77 |
| 511 | r = sched_review i |
| 512 | i = at_start c 1032 78 |
| 513 | at_ok at_until c i 4 5000 78 |
| 514 | at_ok eq auth_cancel c i 3 79 |
| 515 | at_ok eq get sjout i 2 79 |
| 516 | at_op op 32 |
| 517 | at_ok eq auth_act op 1 4 80 |
| 518 | r = sched_review i |
| 519 | at_race c 81 |
| 520 | at_down c 89 |
| 521 | end |
| 522 | |
| 523 | note Kind 5: the shell exits at once, its 1 s grandchild keeps the output |
| 524 | note open, the cancel lands 200 ms later. |
| 525 | fn at_race c long code int to void |
| 526 | op = new ulong 4 0 |
| 527 | i = at_start c 5033 code |
| 528 | w = at_w |
| 529 | at_ok at_decided c w at_q 3000 code |
| 530 | dl = add ulong monons 3000000000 |
| 531 | for t ulong 1000000 |
| 532 | if or gt auth_cell w 112 0 ge ulong monons dl |
| 533 | break |
| 534 | end |
| 535 | r = sleepns 1000000 |
| 536 | end |
| 537 | pg = auth_cell w 112 |
| 538 | at_ok gt pg 0 82 |
| 539 | r = sleepns 200000000 |
| 540 | at_ok eq auth_cancel c i 2 83 |
| 541 | at_ok at_until c i 4 5000 84 |
| 542 | at_ok eq get sjout i 2 85 |
| 543 | at_op op 33 |
| 544 | at_ok eq auth_act op 1 4 86 |
| 545 | at_ok eq auth_cell w 96 0 87 |
| 546 | gone = false |
| 547 | for t ulong 3000 |
| 548 | if eq killpid neg int pg 0 neg long 3 |
| 549 | gone = true |
| 550 | break |
| 551 | end |
| 552 | r = sleepns 1000000 |
| 553 | end |
| 554 | at_ok gone 88 |
| 555 | end |
| 556 | |
| 557 | note Phase F: a worker killed while its tool runs: the creator kills the |
| 558 | note tool's process group and records UNKNOWN; the job is UNKNOWN. |
| 559 | fn at_death to void |
| 560 | op = new ulong 4 0 |
| 561 | c = at_setup 90 |
| 562 | i = at_start c 2040 91 |
| 563 | w = at_w |
| 564 | p = at_gp c w 5000 |
| 565 | at_ok gt p 0 92 |
| 566 | at_ok eq killpid int get swpid w 9 0 93 |
| 567 | at_ok at_until c i 6 5000 94 |
| 568 | at_op op 40 |
| 569 | at_ok eq auth_act op 1 3 95 |
| 570 | at_ok at_gone p 3000 96 |
| 571 | at_ok eq auth_cell w 112 0 97 |
| 572 | at_down c 98 |
| 573 | end |
| 574 | |
| 575 | note Every live worker has acknowledged the latest control with paused |
| 576 | note flag pv, within ms; stepping meanwhile. |
| 577 | fn at_acked c long pv ulong ms ulong to bool |
| 578 | dl = add ulong monons mul ms 1000000 |
| 579 | for t ulong 1000000 |
| 580 | ok = true |
| 581 | for w ulong 2 |
| 582 | if or ne auth_cell w 64 auth_cell w 0 ne auth_cell w 104 pv |
| 583 | ok = false |
| 584 | end |
| 585 | end |
| 586 | if ok |
| 587 | ret true |
| 588 | end |
| 589 | if ge ulong monons dl |
| 590 | ret false |
| 591 | end |
| 592 | at_step c |
| 593 | end |
| 594 | ret false |
| 595 | end |
| 596 | |
| 597 | note Phase G: pause reaches every worker through its control notification; |
| 598 | note while paused a proposal is held undecided and a ready job is not |
| 599 | note assigned; resume decides and assigns, and both jobs are performed. |
| 600 | fn at_pausec to void |
| 601 | c = at_setup 115 |
| 602 | j = at_start c 1050 116 |
| 603 | w = at_w |
| 604 | q = at_q |
| 605 | at_ok at_prop c w q 3000 117 |
| 606 | k = auth_pause c true |
| 607 | at_ok at_acked c 1 1000 118 |
| 608 | i = sched_admit 1051 0 0 |
| 609 | at_ok ge i 0 119 |
| 610 | for t ulong 60 |
| 611 | at_step c |
| 612 | end |
| 613 | at_ok lt auth_cell w 16 q 120 |
| 614 | at_ok eq get sjst ulong i 2 121 |
| 615 | k = auth_pause c false |
| 616 | at_ok at_acked c 0 1000 122 |
| 617 | at_ok at_until c j 4 5000 123 |
| 618 | at_ok eq get sjout j 2 124 |
| 619 | at_ok at_until c ulong i 4 5000 125 |
| 620 | at_ok eq get sjout ulong i 2 126 |
| 621 | at_ok eq at_runs 2 127 |
| 622 | at_down c 128 |
| 623 | end |
| 624 | |
| 625 | fn main to int |
| 626 | at_perform |
| 627 | at_stale |
| 628 | at_forged |
| 629 | at_revoke |
| 630 | at_cancel |
| 631 | at_death |
| 632 | at_pausec |
| 633 | if ne write 1 sok 0 len sok long len sok |
| 634 | ret 100 |
| 635 | end |
| 636 | ret 0 |
| 637 | end |