Jenda Krynicky wrote:

> Windows is one example.
> 
> There you do not create a new process by forking and then changin the
> program your process executes, but by a CreateProcess():
> 
> (from MSDN)
> The CreateProcess function creates a new process and its primary
> thread. The new process runs the specified executable file in the
> security context of the calling process.
> 
> BOOL CreateProcess(
>   LPCTSTR lpApplicationName,
>   LPTSTR lpCommandLine,
>   LPSECURITY_ATTRIBUTES lpProcessAttributes,
>   LPSECURITY_ATTRIBUTES lpThreadAttributes,
>   BOOL bInheritHandles,
>   DWORD dwCreationFlags,
>   LPVOID lpEnvironment,
>   LPCTSTR lpCurrentDirectory,
>   LPSTARTUPINFO lpStartupInfo,
>   LPPROCESS_INFORMATION lpProcessInformation
> );
> 
> 
> fork() is totally alien to Windows.
> Therefore perl under Windows implements system() with
> CreateProcess(), fork() is emulated by creating thread and exec()
> uses CreateProcess() and exits the current thread or process.
> 
> This means that it's much more efficient to use system() then
> fork() & exec() under Windows.
> 
> Jenda
> P.S.: I did not look at the actual implementation of fork(), exec()
> and system() in Perl sources. This is just from what I know about
> windows and what I read in the docs and posts. But I believe I am
> about right.

Perl implement fork() internally (after 5.6.X i think) so even OS that do 
not support fork() can be fork. i am not sure if that is true on Windos or 
not.

prior to 5.6, yes fork() is implemented differently(or not implemented at 
all for some OS) but after 5.6, Perl handles this by dupping itself, which 
is very expensive according to the doc but it gives all user on all OS the 
same interface to the [U|Li]nux fork world.

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to