On Wed, 14 Sep 2005, Bernd Schoeller wrote:

> On Wed, Sep 14, 2005 at 10:03:36AM -0600, Tobias Weingartner wrote:
> >
> > Anything not covered by man pages is covered by the source.
> 
> This is nicely said, but ...
> 
> reading source code (any language) of a complex system is very
> difficult without information on concepts. It is like trying to find
> your way around a city without a map.

depends on your question.

q: "how does the kernel switch processes?"
a: see sys/kern/sched_bsd.c (this answer should be obvious after a cursory 
look at how the files are laid out)
q: "but how does it switch?"
a: the code is in locore.s.  it varies by platform. (this answer 
complements of grep)
q: "so which register does it save first?"
a: if you can't read the assembly, what good would this knowledge do you?

to expect a man page, or any documentation, to answer the last question is 
pretty absurd.

it's much better to think about the kernel has a collection of subsystems 
that work together.  you need to know the interfaces, and _what_ the 
pieces do, but the _how_ is often irrelevant.  if you're going to devise 
the latest and greatest O(0.5) scheduler, you only need to know to call 
cpu_switch(), not how it accomplishes its magic.

and sometimes the answer to "why?" is "because" and that's all there is.

i appreciate that the more you understand, the better, but step back and 
think about it.  if you need to know how some piece of code works (beyond 
the basic what does it do or how to use it):
a.  you are trying to change the code.  attempting to do so with an 
understanding gleaned from a book and not from the code itself is a recipe 
for disaster.
b.  you are curious.  if you want to learn, get serious about it and 
actually look at what you're studying.

also, look at other systems.  freebsd is another bsd kernel, but the 
actual implementation is many areas is different.

-- 
And that's why Fischer would have beaten Kasparov.

Reply via email to