From: Micha Feigin (michf_at_nonexisting.hamakor.org.il)
Date: Sun 23 May 2004 - 21:22:09 IDT
On Sun, May 23, 2004 at 05:36:32PM +0000, Oleg Goldshmidt wrote:
> Micha Feigin <michf_at_post.tau.ac.il> writes:
>
> > A dirty solution that doesn't achieve exactly what you want but is the
> > closest alternative to threads is to do a vfork and exec self with a
> > special flag.
> >
> > This should work under mingw etc.
>
> Check what vfork() does - it may simply fork() [e.g. under cygwin]
>
On modern linux vfork and fork are the same since fork marks pages copy
on write thus the overhead compared to vfork, which does very little
other then duplicating the process structure in the kernel, which is
why you shouldn't do anything much after vfork except exec and
_exit. One of the worse things you can do for example is return from
the function call, ruining the stack.
On older systems which didn't allow marking pages copy on write fork
had to duplicate all the memory pages of the process (IIRC it
duplicated everything except the text area) which is the reason for
vfork which was meant to only be used for exec and relatives.
This depends on system support. On system with no virtual memory for
example you have no way to implement fork, but vfork is still possible
(you can have a full functioning linux with no fork but its very
difficult to do anything with no vfork. For example no shell is
possible without vfork).
> --
> Oleg Goldshmidt | pub_at_NOSPAM.goldshmidt.org
>
> =================================================================
> To unsubscribe, send mail to linux-il-request_at_linux.org.il with
> the word "unsubscribe" in the message body, e.g., run the command
> echo unsubscribe | mail linux-il-request_at_linux.org.il
>
>
> +++++++++++++++++++++++++++++++++++++++++++
> This Mail Was Scanned By Mail-seCure System
> at the Tel-Aviv University CC.
>
=================================================================
To unsubscribe, send mail to linux-il-request_at_linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request_at_linux.org.il
This archive was generated by hypermail 2.1.7 : Sun 23 May 2004 - 21:30:04 IDT