Re: Differences between FreeBSD and Linux system call mechanism

Terry Lambert (tlambert@primenet.com)
Thu, 3 Sep 1998 22:40:48 +0000 (GMT)


> > Linux uses a call-gate based kernel entry, which is TSS based, and
> > therefore takes more CPU cycles on a contect switch than strictly
> > required. The FreeBSD mechanism for kernel entry (and subsequet
> > context switch) is threfore more efficient than that used by Linux.
>
> I'm starting to wonder. Terry normally knows what he is talking about,
> but this posting seems to contain various mistakes:
>
> 1) Linux system calls are done using software interrupt 0x80 on ia32.
> Does this qualify as a "call-gate based kernel entry"?

"call-gate" should be "task-gate" here.

> 2) I don't see the connection between kernel entry and TSS based task
> switch.

The task switch is implemented by selecting a Tassk Gate descriptor in
either the GDT or the LDT.

See:

Protected Mode Software Architecture
Tom Shanley
MindShare, Inc.
ISBN: 0-201-55447-X

Chapter 11: Mechanics of a Task Switch

> Mingo already has patches that replace the current TSS method
> with software based context switchs.

Good. When these changes have been integrated into the mainstream
releases, Linux will be as fast as FreeBSD in this regard. Which is
beside the main point, that is that you can ask the question as many
ways as you want, kernel threading is still a loss for everything
but SMP, and not a loss there only under specific conditions, which
neither Linux nor FreeBSD can provide at this time.

> 3) I'm not sure about Terrys definition of "efficient", but if he means
> required CPU cycles I thought that there were not that many left in
> Linux that FreeBSD could be better. Has anybody hard numbers for both
> kernels?

CPU cycles and cache line invalidation, both.

Note that FreeBSD does similar things, but only when running a VM86()
task, so the overhead is not constant.

Terry Lambert
terry@lambert.org

---
Any opinions in this posting are my own and not those of my present
or previous employers.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html