=============== clot-demo-6.occ =============== This is a development of the "clot-demo-0" program mailed earlier. It runs the same (busy) cellular automaton model of blood clots flowing down a blood vessel, but is intrumented to allow more user control and gives timing information (cycle times per cell). Generation of blood clots at the start of the blood vessel is automated. There is a user-defined probability of clot generation. Initially, this probability is zero. Such automatically generated blood clots are always of size 1. Individual blood clots (of sizes 1-9) may also be injected at any time. The blood vessel is rendered every 'n' cycles, where 'n' is user defined (between 1 and 65536 in powers of 2). Initially, rendering takes place every cycle. The whole system may be user-frozen at any time. The system may be user-terminated at any time. The display also shows the current cycle count and the average cell cycle time (in nanoseconds) over the previous 512 cycles. These times include the cost of display rendering. To factor this out, increase the cycle interval between frames (see below) to at least 4096. Cell cycle times depend on the "busyness" of the system. Very long blood clots are expensive in this version of the system (as its size is computed each cycle by sending a signal along its whole length). The controls are by keyboard character input: G - increase the probability of clot generation (by 1/256) g - decrease the probability of clot generation (by 1/256) D - increase the cycle interval between frames (by doubling) d - decrease the cycle interval between frames (by halving) 1 - inject a clot of size 1 2 - inject a clot of size 2 . . 9 - inject a clot of size 9 F/f - freeze the system (any character resumes) Q/q - quit the system This version of the program has a blood vessel of (60 x 30) 1800 cells. The screen window needs to be at least 80 across by 40 down for best viewing. Setting the automatic clot generation probability above around (20/256) causes a fatal clot build-up to occur ... after a short while. The generator cell does not allow a backlog of more than 16 clot cells. So, if a clot builds back to the start of the vessel, reducing the clot generation probability to below around (4/256) allows the big clot to break away. If you freeze the system and then resume it, the timing becomes invalid for the cell cycle and it is not shown. Cell cycle times are only shown for uninterrupted sequences of 512 cycles. Note: this version uses the BARRIER SYNC mechanism introduced (by Fred Barnes) into KRoC occam version 1.3.4-pre6. This automates the registration of processes into BARRIERs (CSP mulitway events), making it impossible for an unregistered process to SYNChronise on the BARRIER. Such a mistake was possible with the previous implementation of barriers as a user-defined type. The new mechanism is also faster (apporx. 18 nanoseconds per SYNC, measured on the Dell 3.2 GHz. P4 TUNA nodes). Note: sorry, these BARRIERs may only be used for committed SYNChronisation. An extension allowing them to be used as ALT (CSP choice) guards is being considered. Before that, however, we shall be looking to making these BARRIERs mobile (which a "lazy" version of this clot model is, probably, going to need). Compilation: kroc clot-demo-6.occ -lcourse Peter Welch. (6th. March, 2005)