by Hello71 · 8y ago · 0 comments
The unix interface is broken with respect to threads in many places besides this. Signals. Forking. Problems abound because the concept was bolted on decades later.
A huge area that is broken w.r.t. threading is the whole internationalization stack: setlocale and all.
What if I want to write a server such that each request is executed in a potentially different locale (because it services globally distributed users?)
Just take a gander at all those _r functions where an extra parameter needed to be added for reentrancy.
You can use uselocale() to install a thread-specific locale.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/us...
This only works if your not executing multiple requests in the same thread, ie: using non-blocking IO.
It strikes me as particularly weird as there are notionally POSIX-conformant OSes that implement it in a way that is not atomic.
Right, but the reverse isn't true, which is what I was getting at. That is, availability of hardware parallelism was a prerequisite for anyone wanting threading in the first place.
That isn't true. Having multiple threads for GUI applications makes sense for responsiveness even on a single-core machine.
That's exactly what I was saying, though, specifically, kernel threading support.
> Having multiple threads for GUI applications makes sense for responsiveness even on a single-core machine.
I had never heard this before, but I'm hardly an expert. Is there something you could point to, ideally pre-MP (or pre-MP-popularity), that advocates for kernel thread support being needed for improved GUI responsiveness.
I'll grant that my early Unix knowledge is far from comprehensive, primarily skewed toward hardware at certain universities and in the database industry, as well as mostly BSD, with little from the "AT&T side" before SVR3. Given that, I'd be hard-pressed to name a Unix port that supported SMP prior to 1983.
And I didn't mean to equate SMP with threads, only that thread support wouldn't make much sense without hardware concurrency, of which multi-processor hardware was an early practical example in the Unix world.
As such, it was merely a (failed) rhetorical device to illustrate how designers of filesystem locking might not even have a notion such as intra-process concurrency on their mental radar.
Even if you are, pedantically, correct, it doesn't refute my overall suggestion.