A fork is usually confused with caviar. Spawn is fork + exec (which means the beginning of a process that replaces the current one and inherits some of its external resources, such as open sockets).
Spawn is available in Java (via System.exec, etc.).
Fork is not in Java because it will be very problematic.
A fork requires address space cloning. Kernel support for efficient use is not available on most non-Unix systems; for example, U / win and Cygwin fought to emulate plugs under Win32. In a language such as Java, the garbage collector & amp; JIT compilers will touch Vmem pages, such as that the space will not remain divided after fork for a long time.
Cloning has many side effects. For example, input or output buffers will be processed in all forked children. SysV shared memory will be disconnected.
Most languages ββand many libraries simply refuse forking support. This includes the Streaming API (POSIX); A child cannot use threads until he performs (i.e. becomes a spawn)!
Perl uses fork because its internal elements are very close to C / Unix, and its multithreading is horrific.
The Unix shell uses fork in design, as all local variables and state take snapshots of it. This is why there is no decent Unix shell for a non-Unix environment.
AR
source share