hi!

with fork, you spawn a complete copy of the whole program and run it as
another process, which isn't exactly multithreading. if you do an exec,
you load another program (i think) and run it. if you want to use true
multithreading, in which only part of your program is run as a separate
thread simultaneously with your main program, then you should use
pthreads instead of fork or exec. i dont have a reference handy with me
right now so i cant tell the exact syntax for using pthreads but it goes
something like:

        create_pthread( <worker function>, <parameter>, <other flags>);

the exact syntax may vary but the idea is the same. the worker function
is the function you want to execute in a thread, the <parameter> is of
course the parameter you want to pass to your function.

hope this helps....

joel
=)

> p e a r l i e wrote:
> 
> Hi people !
> 
> Can anybody enlighten me on these questions?
> 
> - If I "fork" from within a program, can that be <considered>
> multithreading ?
> - What about if I do an "exec" ?
> - Is "spawn" different from fork or exec ?
> 
> Thanks.
>
begin:vcard 
n:Realubit;Joel
x-mozilla-html:FALSE
url:http://www.dfnn.com
org:DFNN.com;Production Department
adr:;;;;;;
version:2.1
email;internet:[EMAIL PROTECTED]
title:Communications/Network Programmer
note:"The Pen is mightier than the Sword. But in the hands of a Programmer, the Keyboard is mightier than the Pen!"
fn:Joel Realubit
end:vcard

Reply via email to