0

I have a program that runs multiple tasklets using stackless python, and my problem is that though it is fast, I do notice a slowdown if I start one or more processes that run the same code.

For example, using threads inside the processes it takes my program 6 seconds to complete, and if I start 2 processes it still only takes 6 seconds to complete. But if I use tasklets the program only takes 2 seconds to complete, but then it takes 4 seconds if I run 2 processes simultaneously and 6 seconds if I run 3 processes and etc.

My question is, is this the normal behavior of stackless python? I checked to make sure the tasklets in the separate processes are using separate schedulers and each process can only see their tasklets, but maybe all the tasklets in all the processes are still fighting over system resources? It's the only explanation I can think of for why each additional process would cause a slowdown when using tasklets but not threads. I need someone to explain this to me so I can figure out if there's something wrong with my code or if this is an unavoidable issue.

Jack
  • 23
  • 3
  • 1
    I know it's not exactly what you ask, but have you seen http://stackoverflow.com/questions/377254/stackless-python-and-multicores ? – André Laszlo Jun 29 '15 at 15:40
  • yes I have, and I understand that the tasklets are run sequentially or until one calls stackless.schedule(), but I am wondering if this is the case even if you use separate processes, my understanding was that if I am running two processes then I can have two tasklets running simultaneously, one in each process, and if anybody can confirm this is the case or explain why not I would much appreciate it. – Jack Jun 29 '15 at 17:03
  • 1
    nevermind, it was not a problem with stackless python and multiprocessing, as I made a simple test program that proved the tasklets in the separate processes were running concurrently – Jack Jun 29 '15 at 19:57

0 Answers0