Skip to content

Commit c0dd3c4

Browse files
committed
Doc: Convert the execution model "textual" diagram to a visual diagram (it uses graphivz)
1 parent c042754 commit c0dd3c4

File tree

1 file changed

+78
-9
lines changed

1 file changed

+78
-9
lines changed

Doc/reference/executionmodel.rst

Lines changed: 78 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,35 @@ its operating system (OS), if there is one. When a program runs,
412412
the conceptual layers of how it runs on the host look something
413413
like this:
414414

415-
| **host machine**
416-
| **process** (global resources)
417-
| **thread** (runs machine code)
415+
.. graphviz::
416+
417+
digraph general_comput_model {
418+
graph [
419+
bgcolor=white,
420+
splines=false,
421+
overlap=false,
422+
rankdir=TB,
423+
];
424+
425+
subgraph cluster_host {
426+
label="host machine";
427+
style=filled;
428+
color=lightgrey;
429+
penwidth=2;
430+
shape=ellipse;
431+
432+
subgraph cluster_process {
433+
label="process\n(global resources)";
434+
style=filled;
435+
color=white;
436+
penwidth=2;
437+
438+
thread [label="thread\n(runs machine code)",
439+
style=filled, fillcolor=lightgreen];
440+
441+
}
442+
}
443+
}
418444

419445
Each process represents a program running on the host. Think of each
420446
process itself as the data part of its program. Think of the process'
@@ -471,12 +497,55 @@ Python Runtime Model
471497
The same conceptual layers apply to each Python program, with some
472498
extra data layers specific to Python:
473499

474-
| **host machine**
475-
| **process** (global resources)
476-
| Python global runtime (*state*)
477-
| Python interpreter (*state*)
478-
| **thread** (runs Python bytecode and "C-API")
479-
| Python thread *state*
500+
.. graphviz::
501+
502+
digraph python_exec_model {
503+
graph [
504+
bgcolor=white,
505+
splines=false,
506+
overlap=false,
507+
rankdir=TB,
508+
];
509+
510+
subgraph cluster_host {
511+
label="host machine";
512+
style=filled;
513+
color=lightgrey;
514+
penwidth=2;
515+
shape=ellipse;
516+
517+
subgraph cluster_process {
518+
label="process\n(global resources)";
519+
style=filled;
520+
color=white;
521+
penwidth=2;
522+
523+
subgraph cluster_runtime {
524+
label="Python global runtime\n(state)";
525+
style=filled;
526+
color=lightyellow;
527+
penwidth=2;
528+
529+
subgraph cluster_interpreter {
530+
label="Python interpreter\n(state)";
531+
style=filled;
532+
color=lightblue;
533+
penwidth=2;
534+
535+
subgraph cluster_thread {
536+
label="thread\n(runs Python bytecode and C-API)";
537+
style=filled;
538+
color=lightgreen;
539+
penwidth=2;
540+
541+
thread_state [label="Python thread state",
542+
style=filled, fillcolor=white];
543+
}
544+
}
545+
}
546+
}
547+
}
548+
}
480549

481550
At the conceptual level: when a Python program starts, it looks exactly
482551
like that diagram, with one of each. The runtime may grow to include

0 commit comments

Comments
 (0)