Re: threads vs. processes
From: David Schwartz (davids_at_webmaster.com)
Date: 05/03/03
- Next message: David Schwartz: "Re: Developing Proxy Server - Don't have enough speed"
- Previous message: Lans Redmond: "FTP CR call"
- In reply to: Valentin Nechayev: "Re: threads vs. processes"
- Next in thread: Barry Margolin: "Re: threads vs. processes"
- Reply: Barry Margolin: "Re: threads vs. processes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 3 May 2003 14:18:38 -0700
"Valentin Nechayev" <netch@segfault.kiev.ua> wrote in message
news:20030503145302.GA359@iv.nn.kiev.ua...
> >>> David Schwartz wrote:
> DS> Perhaps in Java, but you don't see many C/C++ programmers saying,
"I
> DS> like to use multithreading because it makes things so easy". Even in
> DS> single-threaded programming, it's bad form to use the stack to hold
context,
> DS> as bad as global variables.
> Well, either global variables are bad, and local variables (in stack) are
> also bad. David, I like Zen wisdom too. But computers don't :(
> Otherwise, do you mean all should be placed in heap? But reference to
object
> in heap is also in stack and also is context.
I mean that state information that relates to some object belongs in
that object itself. That way, you more easily track, manage, and access that
information. The call stack is not the place to hold complex state
information because it makes that state information unaccessible.
> DS> However, using threads to correspond directly to things like
clients is
> DS> just sloppy. They're abstractions of different things. Threads are
execution
> DS> vehicles and you should create as many as you actually need execution
> DS> vehicles.
> So, use thread implementation of N:M model. ;)
How does that help? Threads are still execution vehicles, not clients.
There should be some abstraction in your code that corresponds to a client
but there is no logical reason it should be an execution vehicle. Code is
the most manageable and the most elegant when the abstractions appropriately
correspond to the actual things the program manipulates.
DS
- Next message: David Schwartz: "Re: Developing Proxy Server - Don't have enough speed"
- Previous message: Lans Redmond: "FTP CR call"
- In reply to: Valentin Nechayev: "Re: threads vs. processes"
- Next in thread: Barry Margolin: "Re: threads vs. processes"
- Reply: Barry Margolin: "Re: threads vs. processes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|