News for hackers. Stuff that matters.
Re:Love It or Hate It, Java Continues to Evolve by boyter on Monday June 17, 2019 @04:57AM (#20201091)
Loom is rather nice, but frankly I don't find the lack of co-routines something I miss. You can spawn hundreds of real threads a second so it is possible to write Go style code in Java if you really want. I may change my mind when I actually use it though.

I don't mind what type of data classes they come up with. I just want to not have to write stupidly long constructors, multiple sets or chain-able objects when I want to populate some fields.

Re:Love It or Hate It, Java Continues to Evolve by kjeetgill on Monday June 17, 2019 @05:33AM (#20201250)
I've definitely had to fix servers that have choked themselves with thread abuse, so maybe it's ptsd. The fixes can be as simple as shrinking threadpools to needing substantial rewrites, so I still treat threads as resources requiring management.

Green threads are nice because they let me separate logical execution from operating system resources. Unlike Go, Java will expose the ability to use a custom scheduler, so that should be nice!

My personal pet usecase is actually the opposite. I want to isolate 5-10 "low priority" tasks to a single kernel thread to isolate how much damage misbehaving code can do.

Re:Love It or Hate It, Java Continues to Evolve by pjmlp on Tuesday June 18, 2019 @03:22AM (#20210410)
You can already use custom schedulers with java.util.concurrent though.
Re:Love It or Hate It, Java Continues to Evolve by unscaled on Monday June 17, 2019 @05:42AM (#20201288)
Except that the memory overhead for each thread is MUCH higher: the default would be 1Mb for most JVM implementation.

Yes, you can change the thread stack size, but that's a global fixed size for all threads, so you can't make it to small, or you'll risk stack overflows.

Meanwhile, Go is using dynamically growing stacks, starting at 2k.

Re:Love It or Hate It, Java Continues to Evolve by nvarsj on Monday June 17, 2019 @10:08AM (#20203088)
It doesn’t actually use 1mb. Only if the stack touches the pages will it ever allocate the physical memory. Most threads won’t use more than 16kB (the lower bound when I last tested it on x64). Still, it’s a lot larger than green threads.