import threading import subprocess class MyThread(threading.Thread): def run(self): x = subprocess.Popen(['ls', '-l'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) x.communicate() if __name__ == '__main__': threads = [] for i in range(500): t = MyThread() threads.append(t) t.start() for t in threads: t.join()