Skip to content

Commit

Permalink
Ch. 17: diagrams for concurrent and parallel execution
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskrycho committed Jul 25, 2024
1 parent eb41efb commit cfaf187
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
21 changes: 21 additions & 0 deletions dot/trpl17-01.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
digraph {
dpi = 300.0;

Parallel [label = "Parallel";shape = "plaintext";];
rankdir = "TB";
splines = false;
cluster = true;

node [shape = diamond;];

subgraph cluster_ColleagueA {
newrank = true;
label = "Task 1";
A1 -> A2 -> A3 -> A4;
}

subgraph cluster_ColleagueB {
label = "Task 2";
B1 -> B2 -> B3;
}
}
46 changes: 46 additions & 0 deletions dot/trpl17-02.dot
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
digraph {
dpi = 300.0;

Concurrent [label = "Concurrent";shape = "plaintext";];
rankdir = "TB";
splines = false;
cluster = true;

node [shape = diamond;];

subgraph cluster_task_a {
label = "Task A";

// makes ordering between subgraphs work
newrank = true;

A1;
A2;
A3;
A4;

// for vertical alignment purposes only
A0 [style = invis;];

edge [style = invis;];
}

subgraph cluster_task_b {
label = "Task B";
cluster = true;

// for vertical alignment purposes only
newrank = true;

B0 [style = invis;];

B1;
B2;
B3;
}

A1 -> B1 -> A2 -> B2 -> A3 -> A4 -> B3;

// Makes the heights line up between the boxes.
A4 -> A0 [style = invis;];
}

0 comments on commit cfaf187

Please sign in to comment.