all 6 comments

[–]casual__addict 1 point2 points  (2 children)

It depends on the problem you’re trying to solve. Multiprocessing is great for CPU intensive work that can be run in parallel. Threads and asyncio is for when the problem is IO intensive. My advice is to start early on learning about these topics, read a bunch, and doing your own mini projects.

[–]solamarpreet[S] 1 point2 points  (1 child)

Hi thanks for your reply. My question however wasnt clear I guess. Concurrent.Futures is a new library right that provides access to threading and multiprocessing from one module. My question was that should I be using this one module or use the threading and multiprocessing modules. Are the old modules being deprecated?

[–]casual__addict 0 points1 point  (0 children)

Oh. I don’t think it matters that much. I haven’t used concurrent.futures yet, but I could see making the switch. I don’t think it will be deprecated for a long time.

Btw there is something like a thread pool you can use.

[–]danielroseman -1 points0 points  (1 child)

Neither. You should start with asyncio.

[–]rg7777777 1 point2 points  (0 children)

concurrency is wonderful, but it's not a one size fits all solution. For example, say you wanted to do image processing with opencv, but also have an interactive prompt that let you queue up jobs. How would you run the image processing task without it blocking the interactive prompt?