Thread performance (was Re: dynamic context transitions)

Christopher R. Hertel crh at ubiqx.mn.org
Sun Dec 5 06:20:08 GMT 2004


Sigh...

I really think that this is getting to be just a semantic argument.

Tridge has a very simple and specific definition of threads and processes
(threads share memory space, while processes each have their own virtual
memory space).  In that context, there are a few special cases in which
the threaded model might be faster.  I'll put aside the question of
whether or not those cases are useful, I'm only interested in the fact
that they exist.

Tridge: I really don't think anyone is arguing with you, at least not
  about the things you think we are.  I think we're just looking at the
  questions that this discussion has raised and studying the possible
  answers.  It's an interesting aspect of CS.

  I, for one, am not trying to defend threads.  I'm just trying to grok 
  the issues involved.

When I was in high school I was really, really good at geometry.  It was
the first math class in which I ever got an "A" grade.  Then one day some
college kid--a former student of my geometry teacher's--came into class
and started talking about non-Euclidean geometry.  Nothing he said made
any sense to me but it really bothered me.  It gnawed at me enough that
three years later when I was in college and was told to write a paper
about some aspect of mathemetics I found interesting, I decided to write
about non-Euclidean geometry.  I knew two things when I went into that
project.  The first was that the five postulates were fundamental
mathematical science.  The second was that I was wrong somewhere in my
thinking and just couldn't yet grasp where.  It was a very difficult paper
to write, until one morning at 2:am when my mind was finally tired enough
to stop refusing the let go of the fifth postulate.  Once that happened I
could suddenly see and understand all of it--it was a rush, really.  I
realized that it wasn't that the fifth postulate was "wrong", just that it
was a postulate--a fundamental assumption which, it turned out, could be
changed at will to produce completely different geometries.  It wasn't
until the 20th century that people fully realized that you could make the
fifth postulate a variable, and that space itself could be variably
curved.  (Might have been Einstein, in fact.  Can't remember off hand.)

So, in the context in which we are generally working, I see that it is 
provable that threads are slower than processes.  No problem.  I see your 
logic and it makes perfect sense to me.

The game I am playing in my mind is one of turning the constants into
variables to see what happens.  The definition of a "proccess" and a
"thread" has changed over time.  So have CPUs and Operating Systems.  All
of those things are variables.

This excercise probably doesn't have much practical value.  I'm okay with 
that.  I've got plenty of practical things to do.  :)  My brain gets tired 
of practical things some times and I just like to "think" a bit to see 
what else occurs to me.

I'm working under the assumption that there are alternate configurations
in which using threads would be faster than using processes.  I'm trying
to figure out what would need to change to make that the case.  Possibly
the definition of a process, possibly the definition of a thread, possibly
the underlying assumptions built into the OS, and possibly the kinds of
things you would do with threads when writing an application.  Maybe some
of each.  There's really no harm in considering the problem...

Euclid himself realized that the fifth postulate was weak.  During the
middle ages it became (I kid you not) a religious pursuit to attempt to
prove the fifth postulate from the other four so as to defend Euclid's
geometry as the one true geometry.  In the attempt, several mathematicians
actually created non-Euclidean geometry (as in "this is the stuff that
cannot be true") without knowing it.  Lobachevsky basically used their
work (and, some say, the work of contemporaries), and is credited with
founding non-Euclidean geometry.

http://scienceworld.wolfram.com/biography/Lobachevsky.html

Cool stuff.  I still enjoy it.  I wish I still had a copy of that paper.  
I got an "A" on it.  Still good at geometry.  :)

Chris -)-----

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the samba-technical mailing list