Process Vs Thread Vs Coroutine
Process | Thread | Coroutine | |
---|---|---|---|
Difference | A process can have many thread | A thread can only belong to 1 process | Can run in 1 OR Multiple thread |
Memory | Different process DO NOT share memory if they're not forked from one another | Thread will share memory | Coroutine can share memory since it's single thread |
Concurrency | Different processes can have concurrency and parallelism | A Thread will allow concurrency and parallelism | Depends on the structure. But guarantee to have concurrency |
Coroutine is like Event Queue to execute concurrency.