Multiprocessing in Python

Hi there,

I have a code that can take in any function with two arguements and do processing. However, I would like to implement a feature whether it can limit a number of process running concurrently so as not take up too much resources. I have tried researching for pool.map however I am unable to find solution pertaining to this.

Tried searching for pool.map it shows something like pool (func, iterable, chunksize=NONE), but unsure how to replace it

def multProc(targetin, scanip, port):
    jobs = []
    #pool = multiprocessing.Pool(multiprocessing.cpu_count()) ##8 
    p = multiprocessing.Process(target=targetin, args=(scanip,port))
    jobs.append(p)
    p.start()
    return

Check the multiprocessing.Pool class. The example in the docs give a good insight on how to implement.