You should also know that Linux implements multi-threading (internally) as
processes.  So a multi-threaded program will have multiple 'ps' entries just as
well.


On Thu, 05 Oct 2000, you wrote:
> 
> 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.
> >

----------------------------------------
Content-Type: text/x-vcard; name="joel.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Joel Realubit
----------------------------------------

_
Philippine Linux Users Group. Web site and archives at http://plug.linux.org.ph
To leave: send "unsubscribe" in the body to [EMAIL PROTECTED]

Reply via email to