caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Brian Hurt <brian.hurt@qlogic.com>
To: Lex Stein <stein@eecs.harvard.edu>
Cc: Ocaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] comparison with C performance
Date: Thu, 1 May 2003 14:08:09 -0500 (CDT)	[thread overview]
Message-ID: <Pine.LNX.4.33.0305011354560.3160-100000@eagle.ancor.com> (raw)
In-Reply-To: <Pine.BSF.4.51.0305011437350.75493@bowser.eecs.harvard.edu>


>From memory, task switches on the 386 were 300-500 clock cycles.  By the 
time of the pentium, the nominal cost of a task switch was ~50 cycles 
IIRC, but this did not include the costs of the TLB and cache flushs.  
Which raised the question of how much work you did after the TLB 
determining how expensive the task switch was (and does those costs count 
to task switch costs anyways?).  I don't beleive it's been signifigantly 
improved since then.

Task switches can be a performance problem.  This is, at heart, the 
problem with microkernel operating systems.  Done "canonically" you are 
task switching constantly.  Especially back in the day of the 
Torvalds-Tannenbaum debate, the task switch cost ate you alive.  The 
successfull microkernels generally did without memory protection- an 
example here is the Amiga kernel.  Microkernel, granted, but no memory 
protection either.  Several realtime OSs do the same stunt.  Or, in a 
slightly less extreme way, you can just move more stuff into the same 
task, reducing the number of task switches you need to make.  This is the 
choice Microsoft made with NT, when they moved the core graphics routines 
into the kernel with NT4.  I find it humorously that the "microkernel" NT 
has graphics in the kernel, while the "monolithic kernel" Linux keeps 
graphics in a user space application (X).  But by pulling functions into 
the same task space, A) you are losing a number of advantages of 
microkernels (for example, a misbehaving driver can now crash the kernel), 
and B) you are starting to look an awful lot like a monolithic kernel.  
The successfull kernels today are actually hybrids of monolithic and 
microkernel, to one extent or another, at this point.

On the other hand, task switching isn't nearly the cost of I/O- disk or
network- which I would expect to dominate.  That being said, limiting task
switches is not the only plausible optimizations an in-kernel NFS server
could implement.  I haven't investigated this code, but some plausible
explanations include interrupt/signal latency, scheduling advantages, few
address mappings/reverse mappings, etc.

Brian
On Thu, 1 May 2003, Lex Stein wrote:

> 
> My short answer is: No.
> 
> Thanks
> Lex
> 
> > Wouldn't you expect any userspace nfs server to be much slower than the
> > kernel-based implementation due to the overhead of all the extra
> > context-switching?
> >
> > --
> > Miles Egan <miles@caddr.com>
> >
> 
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> 

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  parent reply	other threads:[~2003-05-01 18:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-01 15:27 [Caml-list] OT: Java Performance Brian Hurt
2003-05-01 17:29 ` [Caml-list] comparison with C performance Lex Stein
2003-05-01 17:55   ` Miles Egan
2003-05-01 18:24     ` Lex Stein
2003-05-01 18:48       ` Miles Egan
2003-05-01 18:38     ` Lex Stein
2003-04-27 19:04       ` Chet Murthy
2003-05-01 19:08       ` Brian Hurt [this message]
2003-05-01 19:13   ` Eray Ozkural
2003-05-02  6:02 Gregory Morrisett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.33.0305011354560.3160-100000@eagle.ancor.com \
    --to=brian.hurt@qlogic.com \
    --cc=caml-list@inria.fr \
    --cc=stein@eecs.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).