BYU Computer Science Students Homepage Index
[pic][pic][pic]
[pic]
Fork and Exec
The fork system call in Unix creates a new process. The new process inherits various properties from its parent (Environmental variables, File descriptors, etc - see the manual page for details). After a successful fork call, two copies of the original code will be running. In the original process (the parent) the return value of fork will be the process ID of the child. In the new child process the return value of fork will be 0. Here's a simple example where the child sleeps for 2 seconds while the parent waits for the child process to exit. Note how the return value of fork is used to control which code is run by the parent and which by the child.
|#include |[pic] |
|#include | |
|#include | |
|using namespace std; | |
|int main(){ | |
|pid_t pid; | |
|int status, died; | |
|switch(pid=fork()){ | |
|case -1: cout ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- college of engineering
- doc ieee 802 15 3 clause 9
- ieee standards draft standard template
- installation back out and rollback guide template
- cs717 programming for fault tolerance
- usb driver an najah national university
- acs ami report
- byu computer science students homepage index
- miscellaneous notes
- odata version 4 0 part 1 protocol
Related searches
- igcse computer science workbooks pdf
- igcse computer science workbook
- igcse computer science workbook answer
- igcse computer science coursebook pdf
- computer science people
- what is computer science like
- computer science revision
- igcse computer science revision notes
- college computer science project ideas
- ideas for computer science project
- computer science projects for students
- computer science final project