F
F
foonfyrick2021-03-31 10:06:53
Kotlin
foonfyrick, 2021-03-31 10:06:53

Stackable coroutines - stackless, thread pool, protothread?

1) If each thread creates its own stack in memory, then when creating a thread pool for the entire pool, its own stack is created?
2) When creating a coroutine, we set a dispatcher that defines the execution context of the coroutine, but if the system creates only the main main thread when the application starts, then how does the coroutine start working in different threads, if there is only a main thread?
3) Since a protothread is a lightweight thread without a stack representing linear code execution with the ability to suspend the execution of a function, can I say that a coroutine without a stack is a protothread? Or are they just very similar?
4) What is the difference between a coroutine without a stack and with a stack? (I could not translate it clearly for myself)
5) 2 bytes are allocated for one coroutine?
6) Cost of blocking coroutine context is 2 bytes?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question