1/5
Flashcards covering the concepts of fork() and related topics from a CIS 390 lecture.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
fork()
Creates a copy of the parent process, including code, data, and resources. Returns the child's PID to the parent process.
fork() return value in Child
Returns 0 to the child process.
fork() return value in Parent
Returns the child's process ID (PID) to the parent process.
fork() return value on Failure
Returns a negative number, typically -1, and may also print a failure message to the parent process.
wait() function
Waits for the first child process to finish before the parent process continues execution.
Variables before fork()
Variables are available to both parent and child, but modifications in one process (parent or child) do not affect the other. The reason is data separation each has independent memory space.