Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.

Commit 7f859d9

Browse files
committed
Update basic.md: enhance comparison table for concurrency models with improved formatting and clarity
1 parent 8af69b4 commit 7f859d9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

basic.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,15 +2886,15 @@ The `Async\getCoroutines()` method returns an array of all coroutines in the app
28862886

28872887
### Comparison Table
28882888

2889-
| **Language** | **Asynchrony Model** | **Structured Concurrency** | **Function Coloring** | **Cancellation Mechanism** | **Error Detection / Error Handling** | **Learning Complexity** | **Additional Notes** |
2890-
|-------------------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------|--------------------------------------------------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
2891-
| **True Async** | `spawn + await`, “transparent” coroutines with a separate Scheduler/Loop | **Yes.** Through `Scope`, hierarchical tasks, `dispose()`, `bounded`, `inherit` | **No** (any function can become a coroutine) | `CancellationException` + `until`, `Scope.cancel()` | Warnings for “zombie” coroutines, `setExceptionHandler`, automatic cancellation, Graceful Shutdown. Includes a supervision-like approach via `Scope` and detection of stuck tasks | **Medium / somewhat high** – new keywords + learning Scopes and scheduling | Incompatible with Fiber; requires non-blocking I/O rework, but provides strong resource lifecycle control |
2892-
| **Go** | goroutine + channels, no `await` | **No** (or manual via WaitGroup/channels) | **No** | Context-based (manual) cancellation | No built-in supervision; errors are returned or handled via `panic/recover`. Easy to accidentally leave goroutines running. | **Low** (syntax is simple, though easy to “leak” goroutines) | Widely used. Good for simpler concurrency cases, but can accumulate hidden or leftover goroutines in more complex scenarios |
2893-
| **Kotlin** | `suspend` functions + coroutines in the stdlib | **Yes.** `coroutineScope`, `supervisorScope` | **Yes** (`suspend` “colors” methods) | Cooperative: `Job.cancel()` | Built-in coroutine cancellation, aggregated exceptions, `supervisorJob` can isolate child failure | **Medium** (needs `suspend` keyword, but well-documented) | A powerful concurrency model with structured scopes, though it requires function “coloring” |
2894-
| **C#** | `async/await` with `Task` | **No** (often `Task.WaitAll` or custom patterns) | **Yes** (`async` methods) | `CancellationToken` (cooperative checks) | `AggregateException` or standard try/catch; advanced patterns often need extra frameworks | **Medium** (well documented, but advanced usage is tricky) | Mature ecosystem. No direct built-in structured concurrency, but many community libraries and patterns |
2895-
| **Python** | `asyncio` (tasks, event loop) with `async/await` | **Partially.** `TaskGroup` (Python 3.11+) | **Yes** (`async def` “colors” methods) | Limited: can `cancel()` a `Task`, but no universal token | Exceptions bubble through tasks, optional grouping with `TaskGroup`, no dedicated supervision. Some libraries add partial solutions | **Medium** (simple syntax, but `asyncio` architecture is complex) | Large ecosystem, complicated by the GIL and partial coverage for async libraries |
2896-
| **Java (Loom)** | Virtual threads (experimental), classic `Thread`/`Future` | **Under development** (drafting `StructuredTaskScope`) | **No** (virtual threads are “just calls”) | `Thread.interrupt()` or `Future.cancel()`, details evolving | Standard try/catch + Executor; Loom may introduce structured concurrency, still experimental | **Medium** (familiar threads, but Loom is new/experimental) | Could greatly simplify concurrency while remaining compatible with existing Java code |
2897-
| **Erlang/Elixir** | Actor model (lightweight processes) + message passing, “let it crash” | **Yes.** Supervisor trees | **No** | Kill the process from outside, or it crashes & restarts | Powerful supervision system: if a process crashes, the supervisor restarts it. Very fault-tolerant. | **Medium** (actor model is straightforward but requires a shift) | Renowned for high fault tolerance. “Supervisor trees” provide robust structured concurrency and auto-restart. Different paradigm from `await`/tasks — message-based and “let it crash” philosophy. |
2889+
| **Language** | **Asynchrony Model** | **Structured Concurrency** | **Function Coloring** | **Cancellation Mechanism** | **Error Detection / Error Handling** | **Learning Complexity** | **Additional Notes** |
2890+
|-------------------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------|--------------------------------------------------|------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
2891+
| **True Async** | `spawn + await`, “transparent” coroutines with a separate Scheduler/Loop | **Yes.** Through `Scope`, hierarchical tasks, `dispose()`, `bounded`, `inherit` | **No** (any function can become a coroutine) | `CancellationException` + `until`, Coroutine or Scope `cancel()` | Warnings for “zombie” coroutines, `setExceptionHandler`, automatic cancellation, Graceful Shutdown. Includes a supervision-like approach via `Scope` and detection of stuck tasks | **Medium / somewhat high** – new keywords + learning Scopes and scheduling | Incompatible with Fiber; requires non-blocking I/O rework, but provides strong resource lifecycle control |
2892+
| **Go** | goroutine + channels, no `await` | **No** (or manual via WaitGroup/channels) | **No** | Context-based (manual) cancellation | No built-in supervision; errors are returned or handled via `panic/recover`. Easy to accidentally leave goroutines running. | **Low** (syntax is simple, though easy to “leak” goroutines) | Widely used. Good for simpler concurrency cases, but can accumulate hidden or leftover goroutines in more complex scenarios |
2893+
| **Kotlin** | `suspend` functions + coroutines in the stdlib | **Yes.** `coroutineScope`, `supervisorScope` | **Yes** (`suspend` “colors” methods) | Cooperative: `Job.cancel()` | Built-in coroutine cancellation, aggregated exceptions, `supervisorJob` can isolate child failure | **Medium** (needs `suspend` keyword, but well-documented) | A powerful concurrency model with structured scopes, though it requires function “coloring” |
2894+
| **C#** | `async/await` with `Task` | **No** (often `Task.WaitAll` or custom patterns) | **Yes** (`async` methods) | `CancellationToken` (cooperative checks) | `AggregateException` or standard try/catch; advanced patterns often need extra frameworks | **Medium** (well documented, but advanced usage is tricky) | Mature ecosystem. No direct built-in structured concurrency, but many community libraries and patterns |
2895+
| **Python** | `asyncio` (tasks, event loop) with `async/await` | **Partially.** `TaskGroup` (Python 3.11+) | **Yes** (`async def` “colors” methods) | Limited: can `cancel()` a `Task`, but no universal token | Exceptions bubble through tasks, optional grouping with `TaskGroup`, no dedicated supervision. Some libraries add partial solutions | **Medium** (simple syntax, but `asyncio` architecture is complex) | Large ecosystem, complicated by the GIL and partial coverage for async libraries |
2896+
| **Java (Loom)** | Virtual threads (experimental), classic `Thread`/`Future` | **Under development** (drafting `StructuredTaskScope`) | **No** (virtual threads are “just calls”) | `Thread.interrupt()` or `Future.cancel()`, details evolving | Standard try/catch + Executor; Loom may introduce structured concurrency, still experimental | **Medium** (familiar threads, but Loom is new/experimental) | Could greatly simplify concurrency while remaining compatible with existing Java code |
2897+
| **Erlang/Elixir** | Actor model (lightweight processes) + message passing, “let it crash” | **Yes.** Supervisor trees | **No** | Kill the process from outside, or it crashes & restarts | Powerful supervision system: if a process crashes, the supervisor restarts it. Very fault-tolerant. | **Medium** (actor model is straightforward but requires a shift) | Renowned for high fault tolerance. “Supervisor trees” provide robust structured concurrency and auto-restart. Different paradigm from `await`/tasks — message-based and “let it crash” philosophy. |
28982898

28992899
#### Parallels with Java Loom
29002900

0 commit comments

Comments
 (0)