3 ms·
All the different flavors of libc, apart from the outdated and cryptic naming style, have many hidden flaws like this one, heavy multithreading was not a centra
by stephc_int13 2y ago
All the different flavors of libc, apart from the outdated and cryptic naming style, have many hidden flaws like this one, heavy multithreading was not a central design feature when it was designed, and there are many instances of global state, with workarounds to avoid bugs, at the cost of potential serious performance issues.
My opinion is that the standard libc should be used much more as a fallback than a default.
And this is especially true about random number generation, there are much better generators out there, and some of them are only a few lines of code.
https://www.romu-random.org/code.c https://www.romu-random.org/code.c
- cratermoon 2y agoThe SSL cert for that domain expired over 2 years ago Mar 4 23:59:59 2022 GMT
- fsckboy 2y agohttp://web.archive.org/web/20210118071040/http://www.romu-random.org/code.c http://web.archive.org/web/20210118071040/http://www.romu-ra... what this will do is download the .c file rather than just show it to you, not sure I understand that enirely, but just so you know.
- account42 2y agoI assume the response of the original site depends/depended on the user agent and only showed a HTML page for user agents it recognized as a browser, which doesn't include the IA bot.
- citizen_friend 2y agonot supporting multi-threading is not a design flaw, it's a conscious design choice. Multi-threading is hugely overrated as the UNIX kernel already distributes workload across processes and processors. It's a performance hack.
- faeriechangling 2y agoUsing processes to manage threading is more of a hack than having threaded processes.
- citizen_friend 2y ago"manage threading" What does that mean? Do you mean optimize a piece of code to take advantage of multiple cores? Or do you mean describe multiple independent threads of execution. The latter works best when it has it's own memory address and you assume that "if then else" works as you would expect.
- plorkyeran 2y agoThreading is indeed a performance hack - the whole idea of multiple processes sharing an address space is pretty gross and it's very unsurprising that it leads to many bugs - but there's also a reason why it was universally adopted despite the problems. I do think there's a fair argument that libc's design was not a mistake; the thread-unsafe functions worked very well in the environment they were designed for and it wasn't until decades later in a very different environment that they became a problem. Nonetheless, they are a problem now.
- jeffreygoesto 2y agoMy favorite paper about that is https://www2.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf https://www2.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-...
- giantrobot 2y agoShared memory address space is a couple (IIRC) orders of magnitude faster to access than any IPC mechanism. Even on modern very fast machines IPC will add noticeable overhead if you tried to replace threads with processes.
- citizen_friend 2y agoThe question would be how much data are you sending on how frequently. You're still advertising performance. Even so, go ahead and setup shared memory between your processes. Better to explicitly share part, rather than implicitly share full.
- fanf2 2y agoThat random number generator depends on global mutable variables without any protection against concurrent access. It isn’t suitable for production use.