Advanced Programming in the UNIX® Environment
ptg10805159 8 Process Control 8.1 Introduction We now turn to the process control provided by the UNIX System. This includes the ...
ptg10805159 228 Process Control Chapter 8 kernel and is known as a system process. Process ID 1 is usually theinitprocess and is ...
ptg10805159 Section 8.3 forkFunction 229 8.3 forkFunction An existing process can create a new one by calling theforkfunction. # ...
ptg10805159 230 Process Control Chapter 8 Example The program in Figure8.1 demonstrates theforkfunction, showing how changes to ...
ptg10805159 Section 8.3 forkFunction 231 communication is required. In the program shown in Figure8.1, we simply have the parent ...
ptg10805159 232 Process Control Chapter 8 parent process table entry ... fd 0: fd 1: fd 2: flagsfd pointerfile child process tab ...
ptg10805159 Section 8.3 forkFunction 233 Besides the open files, numerous other properties of the parent areinherited by the chi ...
ptg10805159 234 Process Control Chapter 8 Some operating systems combine the operations from step 2—aforkfollowed by an exec—int ...
ptg10805159 Section 8.4 vforkFunction 235 #include "apue.h" int globvar=6;/*external variable in initialized data */ int main(vo ...
ptg10805159 236 Process Control Chapter 8 Most modern implementations ofexitdo not bother to close the streams. Because the proc ...
ptg10805159 Section 8.5 exitFunctions 237 signals generated by the kernel include the process referencing a memory location not ...
ptg10805159 238 Process Control Chapter 8 The final condition to consider is this: What happens when a process that has been inh ...
ptg10805159 Section 8.6 waitandwaitpidFunctions 239 For both functions, the argumentstatlocis a pointer to an integer.Ifthis arg ...
ptg10805159 240 Process Control Chapter 8 #include "apue.h" #include <sys/wait.h> void pr_exit(int status) { if (WIFEXITED ...
ptg10805159 Section 8.6 waitandwaitpidFunctions 241 #include "apue.h" #include <sys/wait.h> int main(void) { pid_t pid; in ...
ptg10805159 242 Process Control Chapter 8 Thewaitpidfunction returns the process ID of the child that terminated and stores the ...
ptg10805159 Section 8.6 waitandwaitpidFunctions 243 #include "apue.h" #include <sys/wait.h> int main(void) { pid_t pid; if ...
ptg10805159 244 Process Control Chapter 8 8.7 waitidFunction The Single UNIX Specification includes an additional function to re ...
ptg10805159 Section 8.9 Race Conditions 245 8.8 wait3andwait4 Functions Most UNIX system implementations provide two additional ...
ptg10805159 246 Process Control Chapter 8 We saw a potential race condition in the program in Figure8.8 when the second child pr ...
«
9
10
11
12
13
14
15
16
17
18
»
Free download pdf