Re: thread rant

From: Mike A. Harris (mharris@meteng.on.ca)
Date: Fri Sep 01 2000 - 22:31:24 EST


On Fri, 1 Sep 2000, Michael Bacarella wrote:

>Q: Why do we need threads?
>A: Because on some operating systems, task switches are expensive.
>
>Q: So, threads are a hack to get around operating systems that suck?
>A: Basically.

Am I understanding correctly then that using fork() is
faster/better? Or should one use a state machine? I'm just
asking out of curiosity because thread programming is new to me.

All portability issues aside, if one is writing an application in
Linux that one would be tempted to make multithreaded for
whatever reason, what would be the better Linux way of doing
things?

I've heard comments from Alan, and others in the past bashing
threads, and I can understand the "threads are for people who
can't write state machines" comments I've heard, but what other
ways are there of accomplishing the goals that threads solve in
an acceptable manner that gives good performance without coding
complexity?

This is all just curiosity. I've considered trying some thread
programming, but if it is as stupid as it sounds, I'd rather
learn the "right" way of writing code that would ordinarily be
done with threads, etc.. Right now, I'm using fork() all over
the place and don't much care how much waste it is... I'd like
to though.

>Q: So, why must Linux support threads?
>A1: : |
>A2: So other programs can be easily ported to Linux!
>
>That can already happen. It's not the *best* implementation. It's
>not as fast as it can be. But it works. And that's all it should do. If
>you're not happy, cope.
>
> "But threads on this system are faster than on Linux!"
>
>The fact that the system implements threads speaks enough about
>it's capabilities. ie, it's trying hard to suck less. So, from my POV,
>we're looking to make Linux suck more by effectively emulating systems
>that are trying to suck less.

Makes sense... if you understand the details of why threads
suck. I understand there are some cache coherency issues, and
I've heard of other things as well, but is there an FAQ out there
saying "Why to not use threads?" that goes into good detail and
provides alternatives?

>But, I've never done anything worthwhile for Linux, so take this for what
>it's worth, from an asshole.

Works for me. ;o)

--
Mike A. Harris                                     Linux advocate     
Computer Consultant                                  GNU advocate  
Capslock Consulting                          Open Source advocate

Be up to date on nerd news and stuff that matters: http://slashdot.org

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:12 EST