Revision | cd7112c807c2ca461b2d635353aea1bec8ab9c7a (tree) |
---|---|
Time | 2023-03-25 07:06:39 |
Author | Albert Mietus < albert AT mietus DOT nl > |
Commiter | Albert Mietus < albert AT mietus DOT nl > |
asis
@@ -3,7 +3,7 @@ | ||
3 | 3 | ========================================= |
4 | 4 | |
5 | 5 | .. post:: |
6 | - :category: Castle, DesignStudy | |
6 | + :category: Castle, DesignStudy, CC2Cpy | |
7 | 7 | :tags: DRAFT |
8 | 8 | |
9 | 9 | Any compiler will read & parse the source, convert it into an abstract natation (like the AST) and write the result |
@@ -23,9 +23,8 @@ | ||
23 | 23 | |
24 | 24 | .. todo:: |
25 | 25 | |
26 | - * Spilt the Modeling & Rendering parts; by using delegating to a ${Any}Rendering subclasses of ${Any} | |
27 | 26 | * Add (pseudo) namespaces-support, global/extern/static keyword and such (during generation) |
28 | - | |
27 | + * Better design & describe the Pre/In/PostFixes (see XXXX) | |
29 | 28 | |
30 | 29 | Overview |
31 | 30 | ========= |
@@ -34,8 +34,8 @@ | ||
34 | 34 | |
35 | 35 | .. _TheMachinery: |
36 | 36 | |
37 | -The Machinery | |
38 | -============= | |
37 | +The Machinery (ToDo) | |
38 | +==================== | |
39 | 39 | |
40 | 40 | The CC-concept has abstracted the communication between components, by using ports, connections, and protocols. A |
41 | 41 | protocol is a “horizontal” interface: two port can be connected when they share the same protocol. |
@@ -57,7 +57,7 @@ | ||
57 | 57 | Some example machineries |
58 | 58 | ------------------------ |
59 | 59 | |
60 | -.. Machinery-DirectCall: | |
60 | +.. _Machinery-DirectCall: | |
61 | 61 | |
62 | 62 | DirectCall |
63 | 63 | ~~~~~~~~~~ |
@@ -68,6 +68,7 @@ | ||
68 | 68 | |
69 | 69 | It works great for simple single-threaded (small) applications |
70 | 70 | |
71 | +.. _Machinery-LibDispatch: | |
71 | 72 | |
72 | 73 | LibDispatch |
73 | 74 | ~~~~~~~~~~~ |
@@ -0,0 +1,28 @@ | ||
1 | +.. -*- rst -*- | |
2 | + included in `a.Heisenbug.rst` | |
3 | + | |
4 | +.. sidebar:: | |
5 | + | |
6 | + .. tabs:: | |
7 | + | |
8 | + .. tab:: Conceptual | |
9 | + | |
10 | + In this diagram, the order of the message in shown in a logical order. As we only show the integers that are | |
11 | + tested for (relative) prime, it looks simple and error-free. | |
12 | + | |
13 | + .. uml:: ./sieve-Sequence-concept.puml | |
14 | + | |
15 | + .. tab:: Out of order | |
16 | + | |
17 | + But there is no garantie that the simple, conceptual order is used. By example, the Generator can be *“fast”*, | |
18 | + and produce the to-be-sieved integers faster than the Sieves handle them. | |
19 | + | |
20 | + .. uml:: ./sieve-Sequence-OOO.puml | |
21 | + | |
22 | + .. tab:: With details | |
23 | + | |
24 | + Adding components-creation details (as well as reconnecting) shows a | |
25 | + lot more details. Here we added the | |
26 | + event/port-names. When studying carefully, we can already see there might be a problem when the order changes ... | |
27 | + | |
28 | + .. uml:: ./sieve-Sequence-details.puml |
@@ -18,7 +18,7 @@ | ||
18 | 18 | |
19 | 19 | |
20 | 20 | What is a Heisenbug? |
21 | -******************** | |
21 | +==================== | |
22 | 22 | |
23 | 23 | The heisenbug is named to Werner Heisenberg, who described the “observer effect”: when you look closely, the behavior |
24 | 24 | changes. The same can happen to software (bugs). The behavior apparently changes when you study -or slightly adjust- |
@@ -26,15 +26,21 @@ | ||
26 | 26 | sequential code on slow CPU’s is less likely to have heisenbugs then concurrent code on fast multi-core systems. It’s |
27 | 27 | also common in threaded programs. |
28 | 28 | |
29 | +.. include:: ./Heisenbug-sidebar-Sequence.irst | |
30 | + | |
29 | 31 | The sieve goes wrong |
30 | 32 | ==================== |
31 | 33 | |
32 | -Also my standard Caste demo ‘Sieve of Eratosthenes’ can suffer from this issue. The initial version did work for years, | |
33 | -and failed horrible when another “machinery” was used. | |
34 | +Also my standard example ‘:ref:`Castle-TheSieve`’ can suffer from this issue. The initial version did work for years, | |
35 | +but failed horrible when another “machinery” was used. After studying this, the bug is simple, and easy to fix. | |
34 | 36 | |
35 | 37 | |
36 | 38 | |
37 | 39 | |
38 | - https://en.wikipedia.org/wiki/Heisenbug | |
40 | + | |
41 | + | |
42 | +======================== | |
43 | + | |
44 | +https://en.wikipedia.org/wiki/Heisenbug | |
39 | 45 | |
40 | 46 | .. LocalWords: heisenbugs, heisenbug |
@@ -0,0 +1,45 @@ | ||
1 | +@startuml | |
2 | +hide footbox | |
3 | +title OutOfOrder (Fast generator) | |
4 | + | |
5 | +participant "Generator" as G | |
6 | +participant "Sieve(2)" as S2 | |
7 | +participant "Sieve(3)" as S3 | |
8 | +participant "Sieve(5)" as S5 | |
9 | +participant "Sieve(7)" as S7 | |
10 | +participant "Sieve(11)" as S11 | |
11 | + | |
12 | +G -[#green]> S2: 2 | |
13 | +G -[#blue]> S2: 3 | |
14 | +G -[#red]> S2: 4 | |
15 | +G -[#blue]> S2: 5 | |
16 | +G -[#red]> S2: 6 | |
17 | +G -[#blue]> S2: 7 | |
18 | +G -[#red]> S2: 8 | |
19 | +G -[#blue]> S2: 9 | |
20 | +G -[#red]> S2: 10 | |
21 | +G -[#blue]> S2: 11 | |
22 | + | |
23 | +activate S2 | |
24 | +S2 -[#green]> S3: 3 | |
25 | +S2 -[#blue]> S3: 5 | |
26 | +S2 -[#blue]> S3: 7 | |
27 | +S2 -[#red]> S3: 9 | |
28 | +S2 -[#blue]> S3: 11 | |
29 | + | |
30 | +activate S3 | |
31 | +S3 -[#green]> S5: 5 | |
32 | +S3 -[#blue]> S5: 7 | |
33 | +S3 -[#blue]> S5: 11 | |
34 | + | |
35 | +activate S5 | |
36 | +S5 -[#green]> S7: 7 | |
37 | +S5 -[#blue]> S7: 11 | |
38 | + | |
39 | +activate S7 | |
40 | +S7 -[#green]>S11: 11 | |
41 | + | |
42 | +activate S11 | |
43 | + | |
44 | +== etc == | |
45 | +@enduml |
@@ -0,0 +1,50 @@ | ||
1 | +@startuml | |
2 | +hide footbox | |
3 | +title Concept (sequential order) | |
4 | + | |
5 | +participant "Generator" as G | |
6 | +participant "Sieve(2)" as S2 | |
7 | +participant "Sieve(3)" as S3 | |
8 | +participant "Sieve(5)" as S5 | |
9 | +participant "Sieve(7)" as S7 | |
10 | +participant "Sieve(11)" as S11 | |
11 | + | |
12 | +G -[#green]> S2: 2 | |
13 | +activate S2 | |
14 | + | |
15 | +G -[#blue]> S2: 3 | |
16 | +S2 -[#green]> S3: 3 | |
17 | +activate S3 | |
18 | + | |
19 | +G -[#red]> S2: 4 | |
20 | + | |
21 | +G -[#blue]> S2: 5 | |
22 | +S2 -[#blue]> S3: 5 | |
23 | +S3 -[#green]> S5: 5 | |
24 | +activate S5 | |
25 | + | |
26 | +G -[#red]> S2: 6 | |
27 | + | |
28 | +G -[#blue]> S2: 7 | |
29 | +S2 -[#blue]> S3: 7 | |
30 | +S3 -[#blue]> S5: 7 | |
31 | +S5 -[#green]> S7: 7 | |
32 | +activate S7 | |
33 | + | |
34 | +G -[#red]> S2: 8 | |
35 | + | |
36 | +G -[#blue]> S2: 9 | |
37 | +S2 -[#red]> S3: 9 | |
38 | + | |
39 | +G -[#red]> S2: 10 | |
40 | + | |
41 | + | |
42 | +G -[#blue]> S2: 11 | |
43 | +S2 -[#blue]> S3: 11 | |
44 | +S3 -[#blue]> S5: 11 | |
45 | +S5 -[#blue]> S7: 11 | |
46 | +S7 -[#green]>S11: 11 | |
47 | +activate S11 | |
48 | + | |
49 | +== etc == | |
50 | +@enduml |
@@ -0,0 +1,62 @@ | ||
1 | +@startuml | |
2 | +hide footbox | |
3 | +title Sieve creation details (sequantial order) | |
4 | + | |
5 | +participant Main as M | |
6 | +participant Finder as F | |
7 | +participant "Generator" as G | |
8 | + | |
9 | +participant "Sieve(2)" as S2 | |
10 | +participant "Sieve(3)" as S3 | |
11 | +participant "Sieve(5)" as S5 | |
12 | +participant "Sieve(7)" as S7 | |
13 | + | |
14 | + | |
15 | + | |
16 | +G -[#purple]\\ F: try(2) | |
17 | +F -\ M: found(2) | |
18 | +M -\ S2: new | |
19 | +activate S2 | |
20 | +G \\--o M: "reconneced to Sieve(2)" | |
21 | + | |
22 | + | |
23 | +G -[#blue]> S2: try(3) | |
24 | +S2 -\\ F: try(3) | |
25 | +F -\ M: found(3) | |
26 | +M -\ S3: new | |
27 | +activate S3 | |
28 | +S2 \\--o M: "reconneced to Sieve(3)" | |
29 | + | |
30 | + | |
31 | +G -[#red]> S2: try(4) | |
32 | + | |
33 | +G -[#blue]> S2: try(5) | |
34 | +S2 -[#blue]> S3: try(5) | |
35 | +S3 -\\ F: found(5) | |
36 | +F -\ M: found(5) | |
37 | +M -\ S5: new | |
38 | +activate S5 | |
39 | +S3 \\--o M: "reconneced to Sieve(5)" | |
40 | + | |
41 | + | |
42 | +G -[#red]> S2: try(6) | |
43 | + | |
44 | +G -[#blue]> S2: try(7) | |
45 | +S2 -[#blue]> S3: try(7) | |
46 | +S3 -[#blue]> S5: try(7) | |
47 | +S5 -\ G: try(7) | |
48 | +F -\ M: found(7) | |
49 | +M -\ S7: new | |
50 | +activate S7 | |
51 | +S5 \\--o M: "reconneced to Sieve(7)" | |
52 | + | |
53 | +G -[#red]> S2: try(8) | |
54 | + | |
55 | +G -[#blue]> S2: try(9) | |
56 | +S2 -[#red]> S3: try(9) | |
57 | + | |
58 | +G -[#red]> S2: try(10) | |
59 | + | |
60 | + | |
61 | +== etc == | |
62 | +@enduml |