Re: Run 2 process in parallel. On Wed, 13 Jun 2007 17:08:52 +0530, umesh.perl@gmail.com ("Umesh T G")
wrote:

>It's a simple script which has to copy some files.
>Martin solution will do that job. Thanks :)
>
>Zen, I had an impression that running parallel jobs is only threads work.
>

If you are on MSWindows, it's all threads, so fork and exec is emulated
with threads.....  it is all threads work underneath for that platform.

But in linux, and in general, threads are all part of a single process,
so if you "exit" in a thread, you will kill all threads. All threads
share the same pid.  Threads let you share information between
them, which is it's selling point.

This is not true in parallel independent processes, BUT in that case
you cannot use shared variables to communicate, you need more
complicated forms of IPC. (Inter-process-communication)

Usually fork and exec is more efficient, so it should be the first
choice.

zentara


-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


