-
-
Save hltbra/90a18cda67b458223dbd1e4a4627cabb to your computer and use it in GitHub Desktop.
PoC to demonstrate Copy-on-Write
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bigobj = range(int(10e6)) | |
print "waiting..." | |
def child(): | |
print "waiting inside child" | |
time.sleep(10) | |
from multiprocessing import Process | |
p = Process(target=child, args=()) | |
raw_input("press enter to start child") | |
p.start() | |
p.join() | |
print "quitting" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bigobj = range(int(10e6)) | |
print "waiting..." | |
def child(): | |
print "waiting inside child" | |
import time | |
#### modify `bigobj` ####### | |
for i in xrange(len(bigobj)): | |
bigobj[i] += 1 | |
############################ | |
time.sleep(10) | |
from multiprocessing import Process | |
p = Process(target=child, args=()) | |
raw_input("press enter to start child") | |
p.start() | |
p.join() | |
print "quitting" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment