|
|
|
Modern Operating Systems by Herbert Bos and Andrew S. Tanenb...
Modern_Operating_Systems_by_Herbert_Bos_and_Andrew_S._Tanenbaum_4th_Ed.pdf
Showing 767 out of 1137
Modern Operating Systems by Herbert Bos and Andrew...
Modern_Operating_Systems_by_Herbert_Bos_and_Andrew_S._Tanenbaum_4th_Ed.pdf-M ODERN O PERATING S YSTEMS
Modern Operating Systems by Herbert...
Modern_Operating_Systems_by_Herbert_Bos_and_Andrew_S._Tanenbaum_4th_Ed.pdf-M ODERN O PERATING S YSTEMS
Page 767
736
CASE STUDY 1: UNIX, LINUX, AND ANDROID
CHAP. 10
Signal
Cause
SIGABRT
Sent to abort a process and force a core dump
SIGALRM
The alarm clock has gone off
SIGFPE
A floating-point error has occurred (e.g., division by 0)
SIGHUP
The phone line the process was using has been hung up
SIGILL
The user has hit the DEL key to interrupt the process
SIGQUIT
The user has hit the key requesting a core dump
SIGKILL
Sent to kill a process (cannot be caught or ignored)
SIGPIPE
The process has written to a pipe which has no readers
SIGSEGV
The process has referenced an invalid memory address
SIGTERM
Used to request that a process terminate gracefully
SIGUSR1
Available for application-defined purposes
SIGUSR2
Available for application-defined purposes
Figure 10-5.
Some of the signals required by POSIX.
10.3.2 Process-Management System Calls in Linux
Let us now look at the Linux system calls dealing with process management.
The main ones are listed in Fig. 10-6.
Fork
is a good place to start the discussion.
The
Fork
system call, supported also by other traditional UNIX systems, is the
main way to create a new process in Linux systems. (We will discuss another alter-
native in the following section.)
It creates an exact duplicate of the original proc-
ess, including all the file descriptors, registers, and everything else. After the
fork
,
the original process and the copy (the parent and child) go their separate ways. All
the variables have identical values at the time of the
fork
, but since the entire parent
address space is copied to create the child, subsequent changes in one of them do
not affect the other. The
fork
call returns a value, which is zero in the child, and
equal to the child’s PID in the parent. Using the returned PID, the two processes
can see which is the parent and which is the child.
In most cases, after a
fork
, the child will need to execute different code from
the parent. Consider the case of the shell.
It reads a command from the terminal,
forks off a child process, waits for the child to execute the command, and then
reads the next command when the child terminates.
To wait for the child to finish,
the parent executes a
waitpid
system call, which just waits until the child terminates
(any child if more than one exists).
Waitpid
has three parameters. The first one al-
lows the caller to wait for a specific child.
If it is
−
1, any old child (i.e., the first
child to terminate) will do. The second parameter is the address of a variable that
will be set to the child’s exit status (normal or abnormal termination and exit
value). This allows the parent to know the fate of its child.
The third parameter
determines whether the caller blocks or returns if no child is already terminated.
Ace your assessments! Get Better Grades
Browse thousands of Study Materials & Solutions from your Favorite Schools
Concordia University
Concordia_University
School:
Operating_Systems
Course:
Introducing Study Plan
Using AI Tools to Help you understand and remember your course concepts better and faster than any other resource.
Find the best videos to learn every concept in that course from Youtube and Tiktok without searching.
Save All Relavent Videos & Materials and access anytime and anywhere
Prepare Smart and Guarantee better grades
Students also viewed documents
lab 18.docx
lab_18.docx
Course
Course
3
Module5QuizSTA2023.d...
Module5QuizSTA2023.docx.docx
Course
Course
10
Week 7 Test Math302....
Week_7_Test_Math302.docx.docx
Course
Course
30
Chapter 1 Assigment ...
Chapter_1_Assigment_Questions.docx.docx
Course
Course
5
Week 4 tests.docx.do...
Week_4_tests.docx.docx
Course
Course
23
Week 6 tests.docx.do...
Week_6_tests.docx.docx
Course
Course
106