aboutsummaryrefslogtreecommitdiff
path: root/src/blog/2023-02-25-job-control/jobs-diagram.tex
blob: 0a919db54f39aa0a499279cbd43cc17d7d8a43a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
\documentclass[crop, tikz]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\usetikzlibrary{arrows.meta}

% Just a workaround to leave some space around the diagram
\filldraw[color=white,fill=white] (-8,-9) rectangle (8,1);

% Boxes
\newcommand{\tbox}[3]{
	\node[draw, rounded corners, text centered, text width=3cm]
		(#1) at (#2) {\bf #3}
	;
}
\tbox  {top}    {0,0}     {Job not running}
\tbox  {left}   {-6,-4}   {Job running in the background}
\tbox  {right}  {6,-4}    {Job running in the foreground}
\tbox  {bottom} {0,-8}    {Job suspended}

% Arrows
\newcommand{\arr}[4]{
	\draw[-{Latex[length=3mm]}, ultra thick]
		(#1) edge[#4] node[fill=white] {\texttt{#3}} (#2)
	;
}
\arr  {top}    {left}   {command \&}       {bend right}
\arr  {left}   {top}    {kill \%job}       {bend right}
\arr  {left}   {bottom} {kill -STOP \%job} {bend right}
\arr  {bottom} {left}   {bg \%job}         {bend right}
\arr  {bottom} {right}  {fg \%job}         {bend left}
\arr  {right}  {bottom} {Ctrl+Z}           {bend left}
\arr  {right}  {top}    {Ctrl+C}           {bend left}
\arr  {top}    {right}  {command}          {bend left}
\arr  {left}   {right}  {fg \%job}         {}
\end{tikzpicture}
\end{document}

Generated with cgit - Back to sebastiano.tronto.net