Recall & Review
beginner
What is a thread in Kotlin?
A thread is a real operating system unit of execution that runs code independently and can run in parallel with other threads.
Click to reveal answer
beginner
What is a coroutine in Kotlin?
A coroutine is a lightweight, cooperative unit of work that can pause and resume without blocking a thread.
Click to reveal answer
intermediate
How do coroutines differ from threads in resource usage?
Coroutines use much less memory and resources than threads because many coroutines can run on a few threads by suspending and resuming.
Click to reveal answer
intermediate
Explain the mental model of coroutines compared to threads.
Think of threads as real workers who can work at the same time, while coroutines are like tasks that can pause their work and let others run on the same worker.Click to reveal answer
intermediate
Why are coroutines considered cooperative multitasking?
Because coroutines decide when to pause and resume, they cooperate to share threads without preemptive interruption.
Click to reveal answer
Which of the following best describes a thread?
✗ Incorrect
Threads are real OS units that run code independently and can run in parallel.
What is a key advantage of coroutines over threads?
✗ Incorrect
Coroutines are lightweight and can suspend without blocking threads, making them efficient.
How do coroutines achieve multitasking?
✗ Incorrect
Coroutines cooperate by suspending and resuming to share threads efficiently.
Which statement is true about threads and coroutines?
✗ Incorrect
Coroutines are lightweight and can run many tasks on fewer threads by suspending and resuming.
Why are coroutines called cooperative multitasking?
✗ Incorrect
Coroutines cooperate by choosing when to pause and resume, sharing threads smoothly.
Explain the difference between coroutines and threads using a simple real-life analogy.
Think about workers and tasks sharing time.
You got /3 concepts.
Describe why coroutines are more efficient than threads for many small tasks.
Focus on how coroutines save memory and CPU.
You got /3 concepts.