I have this simple first multiprocessing code in pyton,but I encounter a BSOD when running it.Can anyone please point out what is wrong with it ?

import multiprocessing
def cracker():
    print "Hello"
    return

procs = []
for i in range(8):
    p = multiprocessing.Process(target = cracker)
    procs.append(p)
    p.start()

for p in procs:
    p.join()

Not a viable option :P
I actually meant to do some sort of benchmarking by finding out primes in parallel by dividing the task by ranges between the 8 cores on my i7.But running the above code simply freezes the system,not to mention various BSODs at times.

Your main code is not protected for importing, which multiprocessing module uses, this works:

import multiprocessing
def cracker():
    print "Hello"
    return

if __name__ == '__main__':
    procs = []
    for i in range(8):
        p = multiprocessing.Process(target = cracker)
        procs.append(p)
        p.start()

    for p in procs:
        p.join()
Comments
excellent

You need to run it properly from command line double click etc. IDLE does not work.

This question has already been answered. Start a new discussion instead.