On 7/17/07, Pranav Peshwe <[EMAIL PROTECTED]> wrote:


IMHO, it does send the data to the buffer. Due to the fork, the new
task(child) gets a copy of the buffer (which already contains the 'Hello
World!' string). This(fork()) is where the duplication occurs. Further
printfs in the two tasks lead to flushing of their respective buffers to the
console. With a '\n' after 'Hello World!', the child would get an empty
buffer to begin with.


Yeah, thats right. The buffer is filled but not flushed. After the
fork, the entire address space (and hence the buffer) gets replicated
and is flushed after the second the printf in both processes.

-aditya

--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List:      (plug-mail@plug.org.in)
List Information:  http://plug.org.in/cgi-bin/mailman/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.

Reply via email to