[fpc-devel] fpfork

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Feb 11 12:02:20 CET 2008

On 11 Feb 2008, at 11:52, Michael Schnell wrote:

> Questions:
> - not in all instances the difference is provided. sometimes fork()  
> is done unconditionally
> - Why is fork used at all. AFAIK, all systems can do vfork() (with  
> _at_least_ the same performance as fork() and thus the difference  
> is not needed. Regarding the function there is a difference between  
> fork() and vfork() only if exec?() is _not_ called immediately  
> afterwards, which seems to be the case in the FP RTL.

In some cases memory is still allocated between the fork and the  
exec. You cannot use vfork in such a case. That code still has to be  
rewritten so it does not allocate any memory.

> - vfork seems to be used in BSD and SUNOS. Why just in these systems ?

Correction: it is only used on those systems if the RTL is libc- 
based. And the reason is that our thread variable implementation and  
its use in the syscall implementations conflicts with using vfork.

> - when doing a non-MMU (µCLinux) architecture fork is not  
> available. What is the best way of handling that situation ?  
> (Should we introduce a UCLINUX OS flavor ?)

Does it already have posix_spawn?


More information about the fpc-devel mailing list