[TUHS] Clever code (was Re: Re: Stdin Redirect in Cu History/Alternatives?

Bakul Shah bakul at iitbombay.org
Thu Dec 15 10:29:45 AEST 2022


On Dec 11, 2022, at 7:09 PM, Andrew Warkentin <andreww591 at gmail.com> wrote:
> 
> It's not necessarily true that microkernels are significantly slower.

uKernels are usually quite fast as they do so little. What can be slow
is emulating a Unix like OS on top due to context switches. For instance,
a user process doing read() will have the following context switches:

  userProc->uK->FileSystem->uK->diskDriver->uk->FileSysem->uK->userProc

or worse (I didn't account for a few things). Because of this even some
uKernels run a few critical services + drivers in the supervisor mode.
But overall slowdown of such a unix emulation will very much depend on the
workload and also what kind of performance improvements you are willing to
try in a complex kernel vs same services running in user mode.

At present the linux kernel has about 31+ Million lines (accounting for
all architectures, filesystems, device drivers etc.). The FreeBSD 13.x
kernel is about 8.7M LoC (of which 44-45% are in device drivers). I only
counted .c and .h files. In contract FreeBSD 2.2.2 kernel has ~554K LoC.
This LoC growth is entirely understandable but I wonder how things may
have turned out in an alternate universe of uKernel based designs....


More information about the TUHS mailing list