3 ms·
> Does that mean that one can use system threads as frivolously as goroutines (e.g. spawning new thread for each incoming request)? Yes. In fact, under Linux o
by otabdeveloper 10y ago
> Does that mean that one can use system threads as frivolously as goroutines (e.g. spawning new thread for each incoming request)?
Yes. In fact, under Linux oftentimes spawning a thread and then running a system call can be faster than just running a system call.
> Conventional C++ wisdom advices against it.
With 32 bit CPU's you might run out of virtual memory quickly, since each thread allocates virtual memory for its stack.
With 64 bit CPU's there are no issues. (Also never forget that virtual memory isn't real memory, it's just a page counter.)
- pcwalton 10y ago> Yes. In fact, under Linux oftentimes spawning a thread and then running a system call can be faster than just running a system call. Interesting, do you have any further info (references, cites) on this?
- scott_s 10y agoSign me up for wanting more info as well. I'm curious how that could work out, since spawning a thread is a system call.