News for hackers. Stuff that matters.
Re:JEP proposed to target JDK 19: 425: Virtual Threads (Prev... by akvadrako on Monday May 02, 2022 @02:00PM (#31238537)
First of all, 512GB of RAM isn't that unusual. If you are supporting a million clients, most applications will need a beefy server. If only 0.1% of your clients are active, that's 1000 cores.

Secondly, you don't need 512kb per thread. The kernel will only use pages that are actually used, so by default new threads will use 4kb.

Re:JEP proposed to target JDK 19: 425: Virtual Threads (Prev... by chrisseaton on Monday May 02, 2022 @02:02PM (#31238567)
I think, but can't prove right now, that Java pre-commits the stack so it has enough head-room to deal with exceptions. Maybe it shouldn't, but it currently does.

And the point still-stands - hardware threads are heavier than virtual threads.

Re:JEP proposed to target JDK 19: 425: Virtual Threads (Prev... by ec109685 on Monday May 02, 2022 @06:55PM (#31242185)
It allocates the entire stack, but it doesn't write into it, so it doesn't take up resident memory until used.
Re:JEP proposed to target JDK 19: 425: Virtual Threads (Prev... by chrisseaton on Monday May 02, 2022 @07:06PM (#31242296)
I'm not a HotSpot expert, but my understanding is it puts the stack through add_reserved_region to commit it.