[This question is for UNIX/Linux users.] Use function kill to end (terminate) a pro- cess. First, end it using a SIGINT signal. Wait three seconds. If it did not respond to the SIGINT signal, send the process to a SIGKILL signal.
What will be an ideal response?
```
#!/usr/local/bin/python
import os
import signal
import time
import sys
pid = os.fork() # create child
signal.signal( signal.SIGINT, signal.SIG_IGN )
if pid != 0: # parent
os.kill( pid, signal.SIGINT )
time.sleep( 3 )
# terminate child with SIGKILL signal
try:
os.kill( pid, signal.SIGKILL )
except OSError:
print "Child already terminated"
elif pid == 0: # child
while 1:
print "Child is still here."
time.sleep( 1 )
else: # could not create child
sys.exit( "Error forking child." )
```
Child is still here.
Child is still here.
Child is still here.
You might also like to view...
The Step Out debugger command can be used to __________.
a) return from the method to the caller b) modify the code at execution time to correct a logic error c) execute the code statements in a different order to locate a bug d) view the code for a called method as it executes
If an instance variable is not modified by public, protected or private then it is said to have:
(a) Package access (b) Default access (c) Friendly access (d) All of the above
Math.pow(4, 1.0 / 2) returns __________.
a. 2 b. 2.0 c. 0 d. 1.0 e. 1
You access the Stroke Styles panel under the Window menu.
Answer the following statement true (T) or false (F)