explaingit

puniverse/quasar

4,560JavaAudience · developerComplexity · 3/5LicenseSetup · moderate

TLDR

Quasar is a Java library that adds lightweight fibers, message-passing channels, and actors so you can write programs that handle hundreds of thousands of concurrent tasks without the overhead of regular threads.

Mindmap

mindmap
  root((quasar))
    What it does
      Lightweight concurrency
      JVM-managed fibers
      Message passing
    Core Concepts
      Fibers
      Channels
      Actors
    Related Projects
      Pulsar for Clojure
      Comsat web APIs
    Setup
      Maven or Gradle
      Java agent flag
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Build a server that handles thousands of simultaneous connections by spawning a lightweight fiber per request instead of a heavy OS thread

USE CASE 2

Pass data safely between concurrent tasks using channels without worrying about shared-memory bugs

USE CASE 3

Structure a concurrent system as independent actors that each process a mailbox of messages, avoiding common threading problems

Tech stack

JavaMavenGradleClojure

Getting it running

Difficulty · moderate Time to first run · 30min

Requires adding a Java agent flag at runtime beyond the standard Maven or Gradle dependency, which is an extra step.

Copyleft dual license, distributing modified code requires sharing your changes under the same license terms.

In plain English

Quasar is a Java library that adds three tools for writing programs that do many things at once: fibers, channels, and actors. These three ideas come from programming languages designed with concurrency at their core, and Quasar brings them to the Java virtual machine. Fibers are like threads, which are the standard way Java runs code in parallel. The difference is that regular Java threads are heavyweight: the operating system manages them, and having thousands of them running at once is impractical. Fibers are managed by Quasar itself rather than the OS, which means you can have hundreds of thousands of them with far less overhead. This makes it practical to write code that spawns a new fiber per incoming request or connection, a style that is natural to read but would be too expensive with regular threads. Channels are a way for fibers or threads to pass data to each other safely, one piece at a time, without sharing memory directly. One fiber puts data into a channel and another reads from it, with the library handling synchronization. Actors add a layer on top of this: each actor is an independent unit that processes messages from a mailbox, one at a time, which avoids many common problems that arise when multiple threads share the same data. Using Quasar requires adding a Java agent flag when running your program. The library is added as a Maven or Gradle dependency. Quasar is also the foundation for two related projects: Pulsar, which provides a Clojure API on top of it, and Comsat, which connects Quasar to Java's standard web APIs. The README is brief and points to external documentation for full usage details. Quasar is dual-licensed under the Eclipse Public License and the GNU Lesser General Public License.

Copy-paste prompts

Prompt 1
Show me how to create a Quasar fiber in Java and use it to run a task concurrently alongside the main thread
Prompt 2
How do I use Quasar channels to pass messages between two fibers without sharing memory directly?
Prompt 3
How do I add Quasar as a Maven dependency and set the Java agent flag required to run it?
Prompt 4
Show me the actor model in Quasar: how do I define an actor, send it a message, and receive a reply?
Open on GitHub → Explain another repo

← puniverse on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.