this post was submitted on 28 Jan 2024
685 points (95.1% liked)

Programmer Humor

32710 readers
249 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 11 months ago

Why do you say this?

Have you tried?

Not if your stacks per thread are small.

Page size is 4k it doesn't get smaller. The kernel can't give out memory in more fine-grained amounts, at least not without requiring a syscall on every access which would be prohibitively expensive.

Anything that slows down threads that isn’t present in an async design should be opt-out-able.

That's what async does. It opts out of all the things, including having to do context switches when doing IO.

As described here you would still need to do a switch to kernel mode and back for the syscalls.

No, you don't: You can poll the data structure and the kernel can poll the data structure. No syscalls required. Kernel can do it on one core, the application on another, so in the extreme you don't even need to invoke the scheduler.


I am unconvinced it must fundamentally be the case.

You can e.g. have a look at whether you can change the hardware to allow for arbitrarily small page sizes. The reaction of hardware designers will be first "are you crazy", then, upon explaining your issue, they'll tell you "well then just use async what's the problem".