skip to Main Content

See the following Python code. I am using the Process class from multiprocessing module to define Python processes. time1 is the time before starting the processes and time2 is the time after all the processes are started. For Ubuntu, the difference between the two times is very small, about 0.1 sec, whereas in Windows it takes about 2 sec to start the processes. What can be done to reduce the time for Windows? Windows hardware is more high-end than Ubuntu’s.

    p1=Process(target=process1Tasks )
    p2=Process(target=process2Tasks )
    p3=Process(target=process3Tasks )
    p4=Process(target=process4Tasks )
    p5=Process(target=process5Tasks )
    p6=Process(target=process6Tasks )
    p7=Process(target=process7Tasks )
    p8=Process(target=process8Tasks )
    p9=Process(target=process9Tasks)
    p10=Process(target=process10Tasks )
    
    time1=time.time()
    p1.start()
    p2.start()
    p3.start()
    p4.start()
    p5.start()
    p6.start()
    p7.start()
    p8.start()
    p9.start()
    p10.start()
    time2=time.time()
    print(time2-time1)

2

Answers


  1. Your question is hardware specific. I ran the same code on a 128gb ram, 32gHz 16 core machine right now and timeit shows 0.016s approximately. It’s not a problem with Windows or Python, these are just softwares -well optimized softwares as a matter of fact.

    Login or Signup to reply.
  2. If I had the same problem, I would have used Linux because Windows is pretty graphic-based and not made for devs. The second best thing you can do is maybe do this in another low-end language like Rust, C, etc. The problem is truly hardware-specific

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search