Lec09-fork wait exit

Lec09-fork wait exit - Reference 10.3.2 Process Management...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Reference Reference 10.3.2 Process Management System Calls in UNIX Modern Operating System 2 nd Edition, Andrew S. Tanenbaum Man pages available in course folder
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 The fork() system call The fork() system call At the end of the system call there is a new process waiting to run once the scheduler chooses it A new data structure is allocated The new process is called the child process. The existing process is called the parent process. The parent gets the child’s pid returned to it. The child gets 0 returned to it. Both parent and child execute at the same point after fork() returns
Background image of page 2
3 Unix Process Control Unix Process Control int pid; int status = 0; if (pid = fork()) { /* parent */ …… pid = wait(&status); } else { /* child */ …… exit(status); } Parent uses wait to Wait variants allow wait on a specific child, or notification of stops and other signals Child process passes status back to parent on exit , to report success/failure The fork syscall returns a zero to the child and the child process ID to the parent Fork creates an exact copy of the parent process
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/23/2011 for the course ART 431 taught by Professor Dona during the Spring '10 term at Alfaisal University.

Page1 / 13

Lec09-fork wait exit - Reference 10.3.2 Process Management...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online