Date: Tue, 15 Jul 2003 00:48:04 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: Nate Williams <nate@yogotech.com> Cc: Chris Knight <chris@e-easy.com.au> Subject: Re: LinuxThreads replacement Message-ID: <3F13B1B4.8765B8F3@mindspring.com> References: <007601c3467b$5f20e960$020aa8c0@aims.private> <004d01c348ae$583084f0$812a40c1@PETEX31> <16146.65087.69689.594109@emerger.yogotech.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Nate Williams wrote: > > Threads are for people who can't write finite state automatons. > > High-level languages are for people who can't write proper assembly > code. > > Nate > > ps. Yes, the above was written tongue-in-cheek. People who make broad > statements like Terry often makes deserve to have their statements > thrown back at them. Threads, like any other tool used by programmers, > can be used for both good and evil purposes, depending on the ability > and experience of the programmer doing the work. One evil purpose threads can be used for is to intentionally exploit a decriptor close race with a blocking fd operation not protected by giant, such that the close invalidates the descriptor before the blocking operation completes, after which the code following the blocking operation dereferences the (now invalid) descriptor contents. Not that anyone would ever write such code on purpose to attack a FreeBSD box from a shell account. Yes, threads is a necessary checkbox item. But I don't need to be all sweetness and light about a facility that I think is badly designed in the standard, and which tends to open up more problems than it's been intended to solve. I can also guarantee you from a performance perspective that an FSA will beat almost anything else you could write, in terms of raw ability to move data, or support high client loads, and will handily beat threads, unless you are on an SMP system, and aren't willing to run multiple copies of the program to do your scaling. Yes, this is somewhat mitigated by the fact that it's easier to write threads code than an FSA, such that a lesser coder is still able to be productive. As a class, it's a tool I would lump in with things like "perl". All that said, FreeBSD's libkse is much less offensive, in terms of overhead and cost, than a raw 1:1 implementation, like the one in the current Solaris, or Linux. Solaris' argument is that it's hard to get something like that correct, and they were worried about the implementation bugs; that just adds fodder to the argument that you should avoid threaded code, where possible. -- Terry
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F13B1B4.8765B8F3>