←back to thread

257 points pg | 3 comments | | HN request time: 0.641s | source
Show context
blinkingled ◴[] No.2120857[source]
Sounds like there is a scalability issue within MzScheme in that it iterates over the number of threads, asking each thread about the sockets it has. As one can tell, once # of threads and # of sockets grow - finding which thread to run in user space becomes awfully expensive. As any clever admin will do, a least invasive fix involving limiting the number of connections and threads was done - with what sounds like immediate results!

I have no idea what MzScheme is but I am curious about why is HN running threads in user space in 2011? The OS kernel knows best what thread to pick to run and that is a very well tuned, O(1) operation for Linux and Solaris.

replies(3): >>2120924 #>>2120962 #>>2120976 #
metageek ◴[] No.2120976[source]
MzScheme is an implementation of Scheme (dialect of Lisp); it implements its own threading. This is not uncommon for languages which support (or used to support) many OSes, with many different versions of threading: it's easier to write it yourself, once, than maintain N+1 OS-specific versions.

Of course, these days, N+1 is probably 2, since everything except Windows supports pthreads.

replies(1): >>2121330 #
1. blinkingled ◴[] No.2121330[source]
If it's just a porting issue, there is Pthreads-win32 which worked well enough the last time I used it few years ago.
replies(1): >>2121350 #
2. metageek ◴[] No.2121350[source]
I don't know the details. I suspect the answer is that the threading support was written when pthread support was less common, and the MzScheme developers haven't been sufficiently interested in rewriting it.
replies(1): >>2134146 #
3. elibarzilay ◴[] No.2134146[source]
Racket now includes a new facility -- "features" -- which are essentially a lightweight OS-level thread. There's also another -- "places" -- which is a more separated heavy threads (closer to a new process), but that one is not enabled by default.