Your question is not clear at all. I suspect that you asking, how to include images in your text. Beside solution provided in Biki Teron answer which has some befits: image is is in place where is inserted in text, however, weeknes arise if on page, where is inserted, is not enough place. Then it is shifted to the next page and left empty space on previous one. To overcome this problem, (La)TeX has floats, by which it try to place image on the best way in the text with floating of image.
For example, in your case:
\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\tikzset{
base/.style = {draw, minimum size=16pt, inner sep=0pt},
resource/.style = {rectangle, base},
process/.style = {circle, base},
allocated/.style = {-latex, thick},
%requested/.style = {latex-, thick, dashed}
}% end of tikzset
\setlength\parindent{0pt}
\usepackage{lipsum}% for dummy text filler
\begin{document}
\lipsum[11]
\begin{figure}[htb]
\centering
\begin{tikzpicture}[scale=2]
\node (p1) [resource] at (1,0) {$P_1$};
\node (p2) [resource] at (1,1) {$P_2$};
\node (p3) [resource] at (1,2) {$P_3$};
%
\node (a) [process] at (0,2) {$A$};
\node (b) [process] at (2,2) {$B$};
\node (c) [process] at (2,0) {$C$};
\node (d) [process] at (2,1) {$D$};
%
\draw[allocated]
(d) edge (p2)
(p2) edge (c)
(c) edge (p1)
(p1) edge (a)
(a) edge (p3)
(p3) edge (b);
\end{tikzpicture}
\caption{my graph}
\label{fig:my graph}
\end{figure}
\lipsum[2]
\end{document}
which generate:

Using any of mentioned solution is independent from complexity included graph. Tikz code can be directly in figure
float environment or can be included for example as
\input{path/<code-file-name>}
Only limitation of graph is its size. Generated image should be smaller than text area of one page.
In case, that you like to add some text as legend to image, this you can do also on the following way:
...
\begin{document}
\lipsum[1]
\begin{figure}[htb]
\centering
\begin{tikzpicture}[scale=2]
\node (p1) [resource] at (1,0) {$P_1$};
\node (p2) [resource] at (1,1) {$P_2$};
\node (p3) [resource] at (1,2) {$P_3$};
%
\node (a) [process] at (0,2) {$A$};
\node (b) [process] at (2,2) {$B$};
\node (c) [process] at (2,0) {$C$};
\node (d) [process] at (2,1) {$D$};
%
\draw[allocated]
(d) edge (p2)
(p2) edge (c)
(c) edge (p1)
(p1) edge (a)
(a) edge (p3)
(p3) edge (b);
\end{tikzpicture}
\medskip
\begin{minipage}{\linewidth}% text in figure environment
\textbf{Legend:} \lipsum*[11]
\end{minipage}
\caption{my graph}
\label{fig:my graph}
\end{figure}
\lipsum[2]
\end{document}
which gives:

Some document classes provide for such cases special environments as legend
in package memoir
.
Note:
I rewrote given example of graph in more concise form. In this I replace obsolete notation \tikzstyle
with tikzset
.
I strongly encourage you as novice to LaTeX to read some of LaTeX introduction text. For example The Not So Short Introduction to LATEX 2ε, or some others.
tikzpicture
environment, it will be ignored unless it is placed in a node, which I don't think it is what you want. Simply write your explanations outside of thetikzpicture
(but put the picture and the explanation inside another environment to be "exported" by preview package)