Re: newbie question: tcp/ip in kernel

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Mon Aug 28 2000 - 16:29:03 EST


On Mon, 28 Aug 2000, Reto Baettig wrote:

> I want to do TCP/IP in the Kernel.
> I already have an implementation running in the 2.2.14 Kernel and it
> looks
> quite good. But I wanted to make sure that I did not miss something
> important because the application I am working on must be very stable
> and
> reliable.

This is probably a straw-man, but I'll bite.

You do not do TCP/IP in the kernel. I don't care how you have hacked
something so it seems to work. The whole idea that you should do TCP/IP
in the kernel demonstrates that you don't understand what the kernel
does.

Unix and Unix variants such as Linux have kernels that perform functions
in behalf of tasks (processes) . The kernel, alone, does not have a
process context so it can't do something for "itself".

To do any kind of communication requires a file-descriptor or socket
that is associated with a process (task). It is essential that a fd
be associated with some process. In fact, since the kernel performs
functions on behalf of the current process, this association is
established as "current" in the kernel. Look into "current" and see
what an amazing object it is!

Alone, there will be no "current". You would be stealing the context
of some task that might not even continue to exist between two uses
of your fd. You would also be using memory and other resources from
some task that you will surely eventually destroy.

It is possible to create a "kernel thread". This is a process that
exists in the kernel but has all the characteristics of a task.
`ps` will show kflushd, kupdate, kpiod, and kswapd. These are kernel
threads. They each have their own pid and they each have their own
context. In principle, such a task could perform TCP/IP.

> What is the proper way to make that thing SMP-Safe in 2.4?

You gotta be kidding.

Cheers,
Dick Johnson

Penguin : Linux version 2.2.15 on an i686 machine (797.90 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

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



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:22 EST