Questions tagged [project-loom]

Project Loom pertains to features and APIs in the Java VM regarding lightweight concurrency and related programming models. Examples include virtual threads (preview in JDK 19) and structured concurrency (incubating in JDK 19).

Project Loom pertains to features and APIs in the Java VM regarding lightweight concurrency and related programming models. Examples include virtual threads (JEP-425 feature introduced in Java 19 as a preview feature) and structured concurrency (incubating in JDK 19).

40 questions
0
votes
0 answers

How to inspect Virtual Threads on a running JVM?

I have been using Project Loom to revive a game server - it's very old code that was written back when green threads were a thing, so writing a server on one-thread-per-connection model was not unreasonable - and it works quite well, in particular…
chesterbr
  • 2,940
  • 3
  • 29
  • 26
0
votes
0 answers

Why don't my 1_000_000 Virtual Threads print a 1_000_000 outcomes?

I was tinkering with Virtual Threads and made this bit of code: List threads = new ArrayList<>(); for(int i = 0; i < 1_000_000; i++){ var thread = Thread.ofVirtual() .unstarted(()->{ …
Mark Rensen
  • 129
  • 1
  • 7
0
votes
0 answers

Why Thread.ofVirtual() and Thread.ofPlatform() named like that?

Why the new methods proposed by JEP 425: Virtual Threads (Preview) are named like that? Given that they return OfVirtual and OfPlatform builder classes, it seems inconsistent with the other usages of of in the standard library. The of static factory…
user2418306
  • 2,352
  • 1
  • 22
  • 33
0
votes
1 answer

Virtual threads slower than single threads

I have a a number of tasks where work can be done in parallel. I have tried this single-threaded and multi-threaded. Code is as follows: private MyTaskResult doTasks( ... ) { try ( var scope = new StructuredTaskScope.ShutdownOnFailure() ) { …
ljm599
  • 41
  • 3
0
votes
1 answer

Project Loom: carrier pinning

Why native code leads to carrier pinning? Is it because to switch carrier thread to another virtual thread, it should be parked from Java code? Also, why File I/O pins a carrier thread as well right now? Is it because there is no async File IO…
Rahul
  • 1,727
  • 3
  • 18
  • 33
0
votes
2 answers

May I have Project Loom Clarified?

Brian Goetz got me excited about project Loom and, in order to fully appreciate it, I'll need some clarification on the status quo. My understanding is as follows: Currently, in order to have real parallelism, we need to have a thread per cpu/core;…
HellishHeat
  • 2,280
  • 4
  • 31
  • 37
0
votes
3 answers

Will Exceptions in Project Loom someday purcolate up through ExecutorService contexts?

From loom-lab, given the code var virtualThreadFactory = Thread.ofVirtual().factory(); try (var executorService = Executors.newThreadPerTaskExecutor(virtualThreadFactory)) { IntStream.range(0, 15).forEach(item -> { …
Eric Kolotyluk
  • 1,958
  • 2
  • 21
  • 30
0
votes
1 answer

Can Project Loom be used from Kotlin?

I am just getting started at playing with Project Loom... Given the Java code which seems to work correctly try (ExecutorService executor = Executors.newVirtualThreadExecutor()) { IntStream.range(0, 16).forEach(i -> { …
Eric Kolotyluk
  • 1,958
  • 2
  • 21
  • 30
-1
votes
1 answer

Helidon Nima + gRPC example

I'm starting a new gRPC project that needs to be production ready early next year. We've been discussing about moving over to Project Loom when it stabilizes. As most of the work is around infra, rewriting code is not a huge risk in case Loom and…
eof
  • 413
  • 4
  • 14
-1
votes
1 answer

TLAB in Virtual Thread - Project Loom

How currently TLAB is handling in Virtual Thread introduced by Project Loom in Java? Is TLAB available in virtual threads?
Matrix12
  • 446
  • 8
  • 19
1 2
3