[go: up one dir, main page]

|
|
Log in / Subscribe / Register

Dynamically sizing the kernel stack

Dynamically sizing the kernel stack

Posted May 31, 2024 10:54 UTC (Fri) by kleptog (subscriber, #1183)
In reply to: Dynamically sizing the kernel stack by Cyberax
Parent article: Dynamically sizing the kernel stack

For example, using Erlang where it is common to have one or more processes per client (eg WhatsApp). These processes are a form of user-space threading though and *very* lightweight. Largely because of the functional nature of the language, no sharing of data between processes and all data being read-only means the stacks can be very small (no registers to be saved/restored) and are allocated on demand. Millions of threads are not unheard of.

But it's running on an interpreter, so can't really be compared with OS level threads in Linux where you're limited by what the hardware can support. If the CPU supported dynamically allocating stack frames when calling a function you'd also be able to get away with much smaller stacks.


to post comments

Dynamically sizing the kernel stack

Posted May 31, 2024 19:21 UTC (Fri) by Cyberax (✭ supporter ✭, #52523) [Link]

> If the CPU supported dynamically allocating stack frames when calling a function you'd also be able to get away with much smaller stacks.

Golang tried that via segmented stacks. The problem is that switching between segments killed performance. So Go moved to relocatable stacks instead, which is easy for them because (by the language design) pointers can't point to objects on the stack.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds