\documentclass[12pt]{standalone}
\usepackage{times}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows,shapes,patterns,fit}
\begin{document}
\begin{tikzpicture}[thick,>={Stealth[width=2mm,length=3mm]},every node/.style={fill=none,font=\scriptsize},
box/.style={draw,rectangle, text width=#1, text centered,minimum height=1cm,font=\small},
box/.default=2.5cm,
ell/.style={ellipse, text width=#1, text centered,minimum height=1cm,font=\small},
ell2/.style={ellipse, text width=#1, text centered,minimum height=1cm},
]
\node[box] at (0,0) (script) {\textit{script} };
\node[box] at ($(script)+(6,0)$) (bash) {\textit{bash} };
\node[box=2cm] at ($(script)-(1,4)$) (term) {Terminal};
\node[box] at ($(term)+(3,0)$) (pseudomas) {Pseudo terminal master};
\node[box=3cm] at ($(pseudomas)+(4,0)$) (pseudosla) {Pseudo terminal slave\\\texttt{(/dev/pts/\ldots)} };
\node[ell=2cm,draw] at ($(term)+(.5,-2.5)$) (user) {User};
\node[text width=5cm,font=\small] at ($(script)+(3.5,2)$) (write) {Write to file (transcript)};
\node[draw,very thick,fit={($(script)+(0,1)$) (term) (pseudosla)}, inner sep=.5cm] (f) {};
\draw[->,dashed] (script) -- node[below] {\textit{fork()} } (bash);
\draw[dashed,very thick] (f.west) -- node[below,pos=.9] {\textit{Kernel space} }(f.east);
\node[anchor=north west,font=\small] at (f.north west) {\textit{User space} };
\draw[<->] (pseudomas) -- (pseudosla);
\draw[->,dotted] (script.40) .. controls ++(-1.5,.2) and ++(-1,-.2) .. (write.west);
\draw[->] (term.135) -- node[left,pos=.85] {stdin} (script.-145);
\draw[<-] (term.120) -- node[right,pos=.15,ell2=.5cm] {stdout\\stderr} (script.-135);
\draw[->] (pseudomas.145) -- node[left,pos=.7] {\textit{read()} } (script.-55);
\draw[<-] (pseudomas.130) -- node[right,pos=.3] {\textit{write()} } (script.-40);
\draw[->] (pseudosla.145) -- node[left,pos=.7] {stdin()} (bash.-145);
\draw[<-] (pseudosla.135) -- node[right,pos=.15,ell2=.5cm] {stdout\\stderr} (bash.-130);
\draw[<->] (term) -- node[right,pos=.3] {keyboard input} node[left,pos=.7] {terminal output} (user);
\end{tikzpicture}
\end{document}