run a pipe
cmd1 | cmd2n such a way that:
cmd2doesn't start running untilcmd1has completely finished
This is impossible in general. Read pipe(7) which reminds you that pipes have limited capacity (typically 4Kbytes or 64Kbytes) and they use some kernel memory for their buffer.
 So the output of cmd1 goes into the pipe. When it becomes full, any write(2) done by cmd1 to STDOUT_FILENO would block (unless cmd1 is specially coded to handle non-blocking I/O to stdout, and this is very unusual) until cmd2 has read(2) from that pipe other's end. If cmd2 did not start, that would never happen.
I strongly recommend reading a book like Advanced Linux Programming which explains that in details (and an entire book is needed to explain all this).
 
                