23 lines
283 B
Python
Executable File
23 lines
283 B
Python
Executable File
#!/usr/bin/python
|
|
|
|
import os
|
|
import time
|
|
|
|
def work():
|
|
j = 0.0
|
|
for i in xrange(10000000):
|
|
j = j + j/2.0
|
|
|
|
|
|
|
|
pid = os.fork()
|
|
if pid != 0:
|
|
print "i spawned %d and am working" % pid
|
|
work()
|
|
else:
|
|
print "i am spawn, and am working"
|
|
work()
|
|
os._exit(0)
|
|
|
|
print "parent done"
|