Re: threads vs. processes
From: Barry Margolin (barry.margolin_at_level3.com)
Date: 05/03/03
- Next message: Rich Teer: "Re: threads vs. processes"
- Previous message: David Schwartz: "Re: threads vs. processes"
- In reply to: David Schwartz: "Re: threads vs. processes"
- Next in thread: David Schwartz: "Re: threads vs. processes"
- Reply: David Schwartz: "Re: threads vs. processes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 02 May 2003 23:29:21 GMT
In article <b8urg8$ran$1@nntp.webmaster.com>,
David Schwartz <davids@webmaster.com> wrote:
> Definitely. User mode threads are, IMO, almost totally useless. The main
>reason people use threads (and this is certainly true in server
>applications!) is to avoid stalling their entire application when they
>block. Why take all the penalties and costs of threads if you don't get the
>primary benefit -- multiple executionn vehicles?!
I always thought that the "main reason" threads were developed is because
it simplifies programming. Rather than writing your own event loop and
maintaining state objects for all your activities, you can just write a
function that handles a single activity and spawn a thread to run it. The
state can be maintained in normal local variables. You can program almost
as if there's just one activity going on; you only have to do anything
special when the threads interact with each other (which is simplified
compared to processes because they share an address space).
Kernel-mode threading is a relatively recent optimization to this. Also a
recent issue is applications which would have so many threads if they
followed the naive model above that they would overload the system. That's
when you have to go to the thread pool model, which necessitates
resurrecting state objects that can be passed to the thread as a parameter;
in this case, you generally need kernel-mode threading because you're
mainly using threads as a fine-grained time-slicing mechanism, not as a
programming abstraction.
-- Barry Margolin, barry.margolin@level3.com Genuity Managed Services, a Level(3) Company, Woburn, MA *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups. Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
- Next message: Rich Teer: "Re: threads vs. processes"
- Previous message: David Schwartz: "Re: threads vs. processes"
- In reply to: David Schwartz: "Re: threads vs. processes"
- Next in thread: David Schwartz: "Re: threads vs. processes"
- Reply: David Schwartz: "Re: threads vs. processes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|