Skip to content

Conversation

@kchung1995
Copy link
Contributor

Corrected the definition of coroutines.

Coroutines are often compared to threads, as some of their characterists are similar. As result, coroutines are well described as lightweight threads in various references. This does not mean that coroutines are lightweight threads.
A single coroutine may work on more than a single thread throughout its lifecycle, being suspended and resumed. A single thread may run numerous coroutines sequentially.

The official document of Kotlin Coroutines also mentions this point. It describes as:

A coroutine is an instance of a suspendable computation. It is conceptually similar to a thread, in the sense that it takes a block of code to run that works concurrently with the rest of the code. However, a coroutine is not bound to any particular thread. It may suspend its execution in one thread and resume in another one.
Coroutines can be thought of as light-weight threads, but there is a number of important differences that make their real-life usage very different from threads.

I peviously proposed the same at Spring Data Commons (PR), and thankfully the maintainer accepted my request as it makes sense to keep align with Kotlin's perspective.

Signed-off-by: Kuyho Chung <kchung1995@gmail.com>
@kchung1995 kchung1995 force-pushed the docs/fix-coroutines-definition branch from 7db1be6 to f1bcc3c Compare January 25, 2026 12:39
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 25, 2026
@sdeleuze sdeleuze self-assigned this Jan 26, 2026
@sdeleuze sdeleuze added type: documentation A documentation task theme: kotlin An issue related to Kotlin support and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 26, 2026
@sdeleuze sdeleuze added this to the 7.0.4 milestone Jan 26, 2026
@sdeleuze sdeleuze closed this in e809395 Jan 26, 2026
@sdeleuze
Copy link
Contributor

Make sense, especially with Virtual Threads now widely available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme: kotlin An issue related to Kotlin support type: documentation A documentation task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants