Re: threads vs. processes

From: David Schwartz (davids_at_webmaster.com)
Date: 05/03/03


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



Relevant Pages

  • Re: [patch 00/11] ANNOUNCE: "Syslets", generic asynchronous system call support
    ... properly separating the user execution context from the kernel execution ... What about TLS related kernel ...
    (Linux-Kernel)
  • Re: urlMappings interaction with web.config hierarchy
    ... Luke Dalessandro wrote: ... Presumably I either need a way to manually load configuration files before the Rewrite happens, or I need a way to execute a .aspx class as if it were located at a different location. ... that's not the currently execution directory, use the GetSection(string, ... the context url, I'm just doing a directory search. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Do people still use the .inc extension?
    ... To be safe, you can add some checks, I personnaly apply the one used in phpBB: ... in the php includes. ... if your file does some code depending on a context, which context doesn't exist if you call that file directly, yes. ... Actually, the execution of the code would be quite predictable, and, if properly coded, should fail anyway if a required variable, etc. is missing. ...
    (comp.lang.php)
  • Re: A lovely drive....or was it?
    ... context" - where any variance due to context will be clearly ... specified within the wording of the law in question - have to a ... as "slow vehicles" as long as it's bimbling along quite happily flat out. ...
    (uk.rec.driving)
  • Re: thread versus task
    ... A process is a program in execution, meaning some code has been loaded in memory, and is intended to be interpreted by the computer as a set of instructions. ... This is called a "context switch," where the "context" includes the current instruction pointer and other register values. ... Some operating systems, like Windows, use "process" to mean the entity represented by some heavyweight internal data structure; threads through the same program are specifically not considered separate processes. ...
    (comp.lang.java.programmer)