Re: Advantages of fork over thread?




Pascal Bourguignon wrote:
"fei.liu@xxxxxxxxx" <fei.liu@xxxxxxxxx> writes:

Hi Group, I am weighting the pros and cons of fork and thread in an
application design.
fork,
pros: per process resource, per process security, portability
cons: slightly more memory use, slightly more expensive context
switch, IPC (mmap) to communicate among processes

thread,
pros: automatically shared global and heap memory, faster context
switches
cons: portability, security (threads are too well mixed), per thread
resource is less.

Please share your insights. Thanks,

The main question you have to answer, is what you want when one context crashes?

If you want all of the contexts of your application to crash at the
same time, then you want threads.

If you want only that context to crash, and the other to go on, then
you want processes.


--
__Pascal Bourguignon__ http://www.informatimago.com/
You never feed me.
Perhaps I'll sleep on your face.
That will sure show you.

I don't see why I cannot tolerate one context crash in the thread
model. Can you elaborate on that? Equally I can also allow the entire
process group to die if there is a single context crash.

.



Relevant Pages

  • Re: Memory barriers, drivers, and interrupts
    ... processor serialization for hardware error boundary purposes. ... serialization almost always implies memory barriers... ... unfortunately no barrier before the context switch. ...
    (comp.programming.threads)
  • Re: Advantages of fork over thread?
    ... switch, IPC to communicate among processes ... automatically shared global and heap memory, faster context ... If you want only that context to crash, and the other to go on, then ...
    (comp.unix.programmer)
  • Re: Advantages of fork over thread?
    ... switch, IPC to communicate among processes ... automatically shared global and heap memory, faster context ... cons: portability, security, per thread ...
    (comp.unix.programmer)
  • Re: Advantages of fork over thread?
    ... switch, IPC to communicate among processes ... automatically shared global and heap memory, faster context ... If you want only that context to crash, and the other to go on, then ...
    (comp.unix.programmer)
  • Re: [Cbe-oss-dev] [PATCH] Cell OProfile: SPU mutex lock fix
    ... could access the lock outside of the SPU switch notification context. ... data collection in a work queue, because under high load (which is what ...
    (Linux-Kernel)