# Kotlin/kotlinx.coroutines

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/kotlin-kotlinx-coroutines).**

13,703 stars · 1,926 forks · Kotlin · apache-2.0

## Links

- GitHub: https://github.com/Kotlin/kotlinx.coroutines
- awesome-repositories: https://awesome-repositories.com/repository/kotlin-kotlinx-coroutines.md

## Topics

`async` `coroutines` `kotlin`

## Description

Kotlinx.coroutines is a library for managing non-blocking background tasks and structured concurrency within the Kotlin programming language. It provides a framework for executing concurrent operations and synchronizing shared state, replacing traditional thread management and complex callback chains with lightweight primitives.

The library utilizes a structured concurrency hierarchy to organize hierarchical background tasks, ensuring that lifecycle management, cancellation, and timeout handling propagate automatically to prevent resource leaks. It employs continuation-passing style transformations to rewrite suspending functions into state machines, allowing execution to pause and resume without blocking underlying threads.

Beyond basic task orchestration, the framework supports reactive data stream processing. This includes the ability to emit asynchronous sequences of values with built-in backpressure support and functional operators, as well as channel-based message passing to decouple producers from consumers. It also provides primitives for atomic state synchronization to maintain data consistency across multiple threads.

The project is distributed as a standard Kotlin library, providing a set of tools for integrating asynchronous logic into application codebases.

## Tags

### Web Development

- [Coroutine Frameworks](https://awesome-repositories.com/f/web-development/server-side-frameworks/kotlin-frameworks/coroutine-frameworks.md) — Provides a framework for executing concurrent operations and synchronizing shared state using lightweight coroutines.

### Programming Languages & Runtimes

- [Concurrency Management Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/task-orchestration-frameworks/concurrency-management-libraries.md) — Provides a comprehensive library for managing non-blocking background tasks and structured concurrency in Kotlin.
- [Structured Concurrency Managers](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/task-orchestration-frameworks/concurrency-management-libraries/structured-concurrency-managers.md) — Manages hierarchical background tasks with automatic cancellation and timeout handling to prevent resource leaks.
- [Reactive Streams Implementations](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/reactive-programming/reactive-streams-implementations.md) — Implements reactive streams with backpressure support and functional operators for asynchronous data processing.
- [Non-Blocking Suspension Points](https://awesome-repositories.com/f/programming-languages-runtimes/code-block-execution/non-blocking-suspension-points.md) — Yields control back to the scheduler during I/O or timer waits to allow threads to perform other work.
- [Multi-threaded Execution](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/concurrency-models/concurrency/execution-models/multi-threaded-execution.md) — Ensures data consistency across multiple threads by controlling access to shared variables.

### Software Engineering & Architecture

- [Structured Concurrency Hierarchies](https://awesome-repositories.com/f/software-engineering-architecture/concurrent-task-runners/structured-concurrency-hierarchies.md) — Organizes background tasks into hierarchies to ensure automatic cancellation and resource cleanup.
- [Asynchronous Execution](https://awesome-repositories.com/f/software-engineering-architecture/architectural-design-patterns/asynchronous-execution.md) — Executes non-blocking tasks concurrently to complete background work without stalling the main thread. ([source](https://github.com/Kotlin/kotlinx.coroutines/tree/master/docs/))
- [Asynchronous Task Orchestration](https://awesome-repositories.com/f/software-engineering-architecture/asynchronous-task-orchestration.md) — Orchestrates non-blocking background operations to maintain application responsiveness without complex callback chains.
- [Atomic State Synchronization](https://awesome-repositories.com/f/software-engineering-architecture/atomic-state-synchronization.md) — Provides low-level atomic primitives for managing shared state across concurrent threads without traditional locking.
- [Message Passing Channels](https://awesome-repositories.com/f/software-engineering-architecture/message-passing-channels.md) — Implements thread-safe communication channels to decouple producers and consumers in concurrent applications.

### Data & Databases

- [Stream Processing](https://awesome-repositories.com/f/data-databases/data-processing-pipelines/stream-processing-systems/stream-processing.md) — Processes asynchronous event sequences with backpressure support and functional operators.
- [Suspension Transformations](https://awesome-repositories.com/f/data-databases/data-transformation-functions/transformation-function-factories/suspension-transformations.md) — Rewrites suspending functions into state machines to enable non-blocking execution without thread suspension.
- [Asynchronous Streams](https://awesome-repositories.com/f/data-databases/typed-data-collections/sequence-management/asynchronous-streams.md) — Emits asynchronous sequences of values with built-in backpressure support for reactive data processing. ([source](https://github.com/Kotlin/kotlinx.coroutines/tree/master/docs/))
- [Shared Memory Data Exchange](https://awesome-repositories.com/f/data-databases/shared-memory-data-exchange.md) — Controls access to shared information across threads to prevent race conditions during parallel processing. ([source](https://github.com/Kotlin/kotlinx.coroutines/tree/master/docs/))

### DevOps & Infrastructure

- [Background Task Runners](https://awesome-repositories.com/f/devops-infrastructure/automation-orchestration/task-execution-frameworks/task-job-management/background-task-runners.md) — Manages background task lifecycles through structured cancellation, timeouts, and hierarchical supervision. ([source](https://github.com/Kotlin/kotlinx.coroutines/tree/master/docs/))

### Development Tools & Productivity

- [Context Propagation](https://awesome-repositories.com/f/development-tools-productivity/task-schedulers/context-propagation.md) — Propagates execution metadata and job state through the call stack to manage task identity and dispatching.
