Sample of drawing of the Computer Processes with TikZ [duplicate]

This question already has an answer here:

i need this as a Tikz drawing but im no able to do the back and forward arrows (1)&(2) and in total im not sure what im doing at all. :

May somebody show me as an starter how to do Tikz drawings correctly?

marked as duplicate by Henri Menke, Mensch, CarLaTeX, TeXnician, NVaughanSep 7 '17 at 4:59

• Member for 9 months, no MWE, and »do it for me«? -1 – Henri Menke Sep 7 '17 at 2:12

for fun, exercise and test some ideas how to draw parallel arrows:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
calc, chains,
positioning,
quotes}

\begin{document}
\begin{tikzpicture}[
node distance = 12mm and 21mm,
start chain = going right,
box/.style = {rounded corners, draw, fill=green!30,
minimum width=9ex, minimum height=1em,
inner sep=1ex, on chain},
tcs/.style = {transform canvas={yshift=#1}},
every edge quotes/.style = {font=\footnotesize, inner sep=1pt, auto}
]
\node (n1)  [box]   {bereit};
\node (n2)  [box]   {aktiv};
\node (n3)  [box]   {beendet};
\node (n4)  [box, below=of $(n1)!0.5!(n2)$]  {blockiert};
\draw[-Triangle]    (n1) edge ["(1)",tcs=+1mm] (n2)
(n2) edge ["(2)",tcs=-1mm] (n1)
(n2) edge ["(5)"]  (n3)
(n2) edge ["(3)"]  (n4)
(n4) edge ["(5)"]  (n1);
\end{tikzpicture}
\end{document} Use TikZ graphdrawing.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{graphs,graphdrawing,quotes}
\usegdlibrary{force}
\begin{document}

\begin{tikzpicture}
\graph[
spring electrical layout,
horizontal=bereit to beendet,
node distance=3cm,
nodes = {rounded corners,draw,fill=green!70!blue}
] {
bereit ->[bend left,"(1)"] aktiv,
aktiv ->[bend left,"(2)"] bereit,
aktiv ->["(3)"] blockiert ->["(4)"] bereit,
aktiv ->["(5)"] beendet
};
\end{tikzpicture}

\end{document} Just for more fun, some dirty tricks. I'm not advocating for this way of coding this particular figure, but they can be useful in other contexts.

1. Use a matrix instead of chains or relative positioning. To place the "blockiert" box in the middle of the "bereit" and "aktiv" boxes, avoinding an extra gap between those, all those nodes are of kind overlay, so that they not take any space. The spacing thus does not depend on the size of these nodes, but it is fixed instead via column sep and row sep options in \matrix.

2. Since the nodes are of size zero, the bounding box of the figure is not properly computed by tikz. This is fixed by "drawing" an extra node comprising all the other nodes, using fit library (and none as drawing color, so that it remains invisible).

3. Use a loop to draw all arrows and numbers. To get the parallel arrows, the trick is to use anchors of the form nodename.number. The number is interpeted as an angle, and the anchor is at the intersection of the node shape with a ray with that angle cast from the node center (eg: ber.5)

So the code is:

\documentclass[margin=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix, fit}

\tikzset{
proc/.style={rectangle, rounded corners,
draw=black!50, fill=green!20,
inner sep=1pt, minimum height=0.7cm, minimum width=1.6cm,
align=center, overlay
}
}

\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of nodes, every node/.style=proc, column sep=1.5cm, row sep=1.5cm] {
|(ber)| bereit &                   & |(akt)| aktiv &      & |(bee)| beendet \\
& |(blo)| blockiert  \\
};
\foreach \start/\ending [count=\n] in  {ber.5/akt.175, akt.185/ber.-5, akt/blo, blo/ber, akt/bee}
{
\draw[-latex] (\start) -- (\ending) node[auto, midway, inner sep=1pt] {\scriptsize (\n)};
}
\node[fit=(ber) (blo) (bee), draw=none] {}; % Fix bounding box
\end{tikzpicture}
\end{document}

And this is the result: got it i think:

\begin{tikzpicture}
[proc/.style={
rectangle,
draw=blue!50,
fill=white,
thick,
inner sep=1pt,
%minimum size=12mm,
minimum height=0.5cm,
minimum width=1.6cm,
align=center
}]
\node[proc]         (bereit)                    {bereit};
\node[proc]         (aktiv)     [right=of bereit]   {aktiv};
\node[proc]         (blockiert) [below right=0.5cm and -0.3cm of bereit]    {blockiert};
\node[proc]         (beendet)   [right=of aktiv]        {beendet};
\path   ([yshift=1mm]bereit.east)   edge        [->]        ([yshift=1mm]aktiv.west)
([yshift=-1mm]aktiv.west)   edge    [->]        ([yshift=-1mm]bereit.east)
(aktiv)     edge    [->]        (beendet)
(aktiv)     edge    [->]        (blockiert)
(blockiert) edge    [->]        (bereit);
\end{tikzpicture}

any better ways to go?

• »any better ways to go?« Is this an answer or not? Also answers should be self-contained on this site, see MWE. – Henri Menke Sep 7 '17 at 2:13