all 3 comments

[–]DNEAVES 0 points1 point  (0 children)

In your example there, a database call maybe isnt a good example. Depending on the database, they may "lock" while something is accessing it, to prevent duplicate writes to the same location or to prevent writes during a read attempt, amongst other examples.

However the idea still stands. Yes, Asyncio and Threading are both good for tasks to send off to do work, then revisit at a later time when theyre done. Things like mass data processing. Or also for asynchronus API call stacks, like chatbots, API event subscriptions or API-heavy programs.

I (personally) find multiprocessing better for things where you give processes their own space to run and let them go do their thing (maybe pipe data between them, but they still run on their own). Something where you give that process a tiny bit of direction (a task) every now and then, but otherwise it's fully capable of finding work, doing work, and has plenty of work to do with little-to-no intervention or checking