Concurrency and Threading

Rava2 provides native support for Java's threading model, mapping java.lang.Thread to system-level pthreads.

Monitors and Synchronization

Thread synchronization is implemented using monitors. Each object in Rava2 can act as a lock.

public class SyncExample {
    public synchronized void update() {
        // Critical section
    }
}

Thread Management

The Rava2 runtime handles thread creation, lifecycle management, and stack allocation for each thread, ensuring that garbage collection correctly identifies roots in every active thread's stack.