git @ Cat's Eye Technologies Matchbox / a77e582
Some small tidying up. Chris Pressey 7 years ago
2 changed file(s) with 11 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
1313 which they write to and read from is shared between them.
1414
1515 It then computes all possible interleavings of these two programs, and
16 executes them all, each on a freshly-zeroed shared memory. Unless _all_
17 the interleavings leave the memory in exactly the same state after execution,
18 the programs have a race condition.
16 executes them all, each on freshly-zeroed registers and shared memory. Unless
17 _all_ the possible interleavings leave the memory in exactly the same state
18 after execution, the programs have a race condition.
1919
2020 Basic Examples
2121 --------------
3030
3131 PROG 1
3232
33 INC M1
33 INC M0
3434
3535 But the following two programs _do_ have a race condition:
3636
5959
6060 There are two pragmas. The first, `DESC`, indicates a section of the
6161 program which contains a human-readable (and computer-ignored) description
62 of the program. The other, `PROG`, specifies which program is being given
63 next in the file.
62 of the following program(s). This description is not free-form; it should be
63 given in terms of comments.
64
65 The other pragma, `PROG`, is followed by an integer which specifies which
66 program is being given next in the file.
6467
6568 These pragmas are only used when the source is a single text file;
6669 if the two programs are being given separately, for example in individual
135138 Can you give me an example? Can you tell me about one you had to find
136139 and fix?" during phone screens.)
137140
138 A huge example that is relevant to virtually every programmer is the
141 A glaring example that is relevant to virtually every programmer is the
139142 filesystem. It's a big, shared, mutable store. There are often some
140143 operations, like renaming a file, that are guaranteed to be atomic; but
141144 most filesystem operations do not have this guarantee.
171174 TODO
172175 ----
173176
174 * better "(can't happen)"
175
176 Slightly more advanced TODO items (might not happen before release):
177
178177 * improve error-checking subsystem to report the program and line number
179178 * better output on "Find RCs" -- explain why it failed
180179 * animation style selector: staggered, black + white, no animation
544544 html += prog.toHTML(regs);
545545 regs[0].clear();
546546 regs[1].clear();
547 mem.clear();
547
548548 var result = prog.run(mem, regs);
549549 if (typeof result === 'string') {
550550 html += "Error: " + result + "<br/>";