# Process locking diagram in LaTeX

Does someone know if it is possible to reproduce something like this Diagram (found at this Website) in LaTeX, perhaps with Tikz?

Or do I have to draw my diagrams in another program and import them as pictures?

I now started as R. Schumacher suggested with pgfgantt. Here is my example:

\documentclass[11pt,a4paper]{article}

\usepackage{tikz}
\usepackage{pgfgantt}
\newcommand{\ganttbarGrey}{\ganttbar[bar/.style={fill=black!50}]}
\newcommand{\ganttbarBlack}{\ganttbar[bar/.style={fill=black}]}
\newcommand{\ganttbarUnderline}{\ganttbar[bar/.style={fill=black},bar top shift=.699, bar height=.001]}

\begin{document}

\begin{tikzpicture}
\begin{ganttchart}[canvas/.style={draw=none},vgrid={*1{black!30,thin}},hgrid={*1{black!30,thin}},include title in canvas=false,title/.style={draw=none, fill=none}]{12}
\ganttbar{$$T_1$$}{3}{3}\ganttbarUnderline{}{4}{9} \ganttbarGrey{}{10}{10} \ganttbar{}{11}{11}\\
\ganttbar{$$T_2$$}{5}{8}\\
\ganttbar{$$T_3$$}{1}{1}\ganttbarGrey{}{2}{2} \ganttbarUnderline{}{3}{3}\ganttbarGrey{}{4}{4} \ganttbarUnderline{}{5}{8}\ganttbarGrey{}{9}{9}\ganttbarUnderline{}{10}{11} \ganttbar{}{12}{12}
\gantttitlelist[title top shift=1.2]{1,...,12}{1}
\end{ganttchart}
\draw[->](0,-3) --(0,0.5);
\draw[->](0,-3) --(6.5,-3);
\end{tikzpicture}

\end{document}


So far it is not that bad but I would like to transform it into a form similar to the one I saw in this diss (look e.g. on page 110). I added the two arrows but I have to manually "calculate" the coordinates.. But this would be ok. But I am missing a possibility to mark where a critical section starts and where it ends (e.g. with "locked" and "unlocked" flags like in the diss).

Does anyone know how to change my example to make it look that way?

I improved my example even more. There was an error in it and I changed some things. Perhaps now it is easier to help me?

-
Look at tex.stackexchange.com/questions/29679/pdflatex-and-pstricks. knulp created a package that should work.. –  user22273 Nov 18 '12 at 17:30

Yes this is possible with TikZ and shouldn’t be hard to do. Have a look at the manual. I’D suggest to set the boxes with nodes of fixed same height (text height=xx) and given width (text width=yy). Everything else would be a simple \draw operation.