3 ms·
What do you like about the underlying system, once you peel back that veneer?
by cardamomo 5y ago
What do you like about the underlying system, once you peel back that veneer?
- yakubin 5y agoI like: 1. VirtualAlloc: 1.1: separation of reserving memory from committing it, thus making overcommit unnecessary, when you want to have memory arenas and reserve a large contiguous chunk of virtual address space, but commit it (so tell the system that you actually want this virtual memory mapped to some physical memory), when you need it. So you can grow your arenas as you need more memory, without worrying that you may not have enough virtual space due to fragmentation, and without relying on invisible things like lazily committing memory on page-faults as long as your program doesn't have any bugs which make it touch that memory in advance and thus make the bugs go unnoticed silently and increase memory use 1.2: ability to implement a circular buffer[1] with a contiguous view instead of head + tail parts; thus making it possible to pass your ring buffer to functions which expect a normal array, and also avoid branches and complexity in code operating on the buffer. Generally, VirtualAlloc > mmap IMO. 2. Behaviour in OOM conditions. Linux can become completely unresponsive for minutes. Windows is usually responsive enough to kill the offending applications. 3. GUI apps have reasonable baseline for performance of GUI. On Windows it's expected that watching YouTube/Netflix you won't see screen tearing. On Linux screen tearing with VOD in browsers is completely unsurprising. 4. Powershell is nice for a whole variety of reasons. 5. CreateProcess > fork [2] 6. MSVC, unlike GCC and Clang, doesn't come with guns for your children when you unknowingly dare trigger UB. [1]: <https://docs.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc2#examples https://docs.microsoft.com/en-us/windows/win32/api/memoryapi...> [2]: <https://www.microsoft.com/en-us/research/uploads/prod/2019/04/fork-hotos19.pdf https://www.microsoft.com/en-us/research/uploads/prod/2019/0...> (Posted from Linux btw.)
- mnw21cam 5y agoTo solve (2), install earlyoom. The problem gets bigger the more RAM you have. The OOM killer runs far too late in my opinion, and earlyoom just gets it to trigger before that point where the system becomes silly.