Spawn (computing)
Spawn (computing)
Main page

Spawn (computing)

logo
Community Hub0 subscribers
What are your thoughts?
Be the first to start a discussion here.
Be the first to start a discussion here.
Spawn (computing)

In computer science, spawn is a function that loads and executes a new child process. The current process may wait for the child to terminate or may continue to execute concurrent computing. Creating a new subprocess requires enough memory in which both the child process and the current program can execute.

There is a family of spawn functions in DOS, inherited by Microsoft Windows.

There is also a different family of spawn functions in an optional extension of the POSIX standards.

The DOS/Windows spawn functions are inspired by Unix functions fork and exec; however, as these operating systems do not support fork, the spawn function was supplied as a replacement for the fork-exec combination. However, the spawn function, although it deals adequately with the most common use cases, lacks the full power of fork-exec, since after fork any process settings which will survive an exec may be changed. However, in most cases, this deficiency can be made up for by using the more low-level CreateProcess API.

In the spawnl, spawnlp, spawnv, and spawnvp calls, the child process inherits the environment of the parent. Files that are open when a spawn call is made remain open in the child process.

The base name of each function is spawn, followed by one or more letters:

The mode argument determines the way the child is run. Values for mode are:

The path argument specifies the filename of the program to execute. For spawnlp and spawnvp only, if the filename does not have a path and is not in the current directory, the PATH environment variable determines which directories to search for the file. The string pointed to by argv[0] is the name of the program to run.

See all
User Avatar
No comments yet.