Call for Discussion: Project proposal: Greenfields

Erik Osterlund erik.osterlund at
Fri Apr 1 07:33:05 UTC 2022

This is a great idea Magnus.

It is so crucial for the environment that we recycle as much as possible. The great thing
with green threads, is that unlike normal threads, they can be recycled by the GC, which
is ever so important for the environment. However, I think that as part of this project,
we should make recycling of green threads even more aggressive. I propose a probabilistic
approach that lets the GC find not just provably garbage green threads, but also
"probably garbage" green threads. I'm sure the user can just create a new thread
in the unlikely scenario that my algorithm is occasionally inaccurate, because everyone
is running stateless apps nowadays anyway. Right?

The algorithm will traverse green thread roots and their transitive closure, looking for
strings that can be associated with probably garbage work that is likely to be just discarded, 
such as "BTC", "ETH", etc. ZGC will then use a new "probably garbage" color in its pointers,
to paint the transitive closure of green threads as "probably garbage". Then the entire
object graph of such green threads can be immediately recycled. In the unlikely event
that such a pointer is loaded by another thread, the load will raise a PrematureRecyclingException.

I think this idea could greatly benefit the environment, and promote recycling to a new level.


> -----Original Message-----
> From: discuss <discuss-retn at> On Behalf Of Magnus Ihse
> Bursie
> Sent: Friday, 1 April 2022 07:52
> To: discuss at
> Subject: Call for Discussion: Project proposal: Greenfields
> With Project Loom[1] getting closer to delivery, we will soon have a world
> where even simple Java programs might use millions of threads.
> This will, in effect, mean a world-wide multiplication on the number of
> threads in Java programs by several magnitudes! This might seem like a
> fantastic win for the Java eco-system, but we are forgetting the effects on
> the real eco-system.
> As you might or might not be aware of, the textile industry is one of the
> heaviest polluter in the world[2]. Adding billions upon billions of new threads
> to this world seem like environmental arrogance.
> I therefore propose we start Project Greenfield, which will research the
> reintroduction of Green Threads, and study how much pesticide and fertilizer
> use will rise due to Project Loom. Project Greenfields will also develop
> prototypes to lower pesticide, fertilizer, and water use for Java programs
> that need to create millions of threads.
> Project Greenfields will deliver its first prototype in exactly one years time,
> April 1, 2023. If this is successful, we can retarget the project for the
> upcoming year, to look at the CO2 cost associated with Java bean production.
> /Magnus
> [1]
> [2]
> 93327/the-impact-of-textile-production-and-waste-on-the-environment-
> infographic

More information about the discuss mailing list