August Levasseur
kiwifarms.net
- Joined
- Dec 13, 2022
What the fuck kind of nigger lang are you using where that kind of monstrosity is considered “the regular way”? Anyways, concurrency is not parallelism. Concurrency is a design strategy wherein related tasks are able to be executed independantly of each other, while parallelism is an execution strategy where tasks are executed at the same time as each other. Concurrency does not necessitate parallelism in that tasks could be executed one at a time, and parallelism does not necessitate concurrency in that the tasks executed need not be related in any way.i am totally ignorant on coroutines
can someone explain to me why i would want to use coroutines instead of just spawning and managing worker threads myself the regular way and handing them whatever task i want done concurrently in the form of some 'task' or 'executable' object?
Coroutines exist to enable concurrent design of programs, those executable objects you talk about handing over to worker threads could be thought of as coroutines, handed to threads to be executed in parallel. Traditionally what were called coroutines were distinct from other concurrency models in that they didn’t feature any parallelism. This isn’t a necessary feature of the model, tho, and I meant coroutines in a general sense, not precluding parallel execution.