Network packet handling

4 views
Skip to first unread message

Michel Megens

unread,
Jun 19, 2012, 1:48:07 PM6/19/12
to orio...@googlegroups.com
Hi,

Lets throw up a little (networking) discussion: How to let the net-core driver handle an incoming packet. I'm asking your opinions specifically on the following:

  • Handle packets thread based;
  • Handle packets not thread based;
  • Some other suggestion
Handling them thread based means, that for every new packet a new thread is created. The benefit of this approach is that the packet will arrive pretty quickly at the application layer, even if a tornado of packets passes along. The downside, on the other hand, is that if such a tornado passes by it might clog up the entire scheduler - which is something we are definitely not waiting for.

A way to fix the problem mentioned above is by defining a maximum amount which the net-core driver my create and if the maximum is reached queue the other packets. The downside of this implementation is that those queue's have to be absolutely concurrency safe. A way to do this is using BermudaOS' event queue's. I can assure you that they will work, but I can assure you also that those functions are definitely not Ferrari's.

The second option is to run them without thread packet handlers. The profit of this is will be relatively simple and fast to implement. I don't think that this will do for a final implementation, since every single packet has to be queued except for the one which is being handle at that moment.This means that packets take long to arrive at the user because the packet queue's will be longer than the queue's at the entry point in Disneyland Paris (and those are long, believe me).

I was thinking of using the theadless implementation as proof of concept and do some rewriting when there is some simple network running.

That was all for now,

Greetings,
Michel Megens

--
Project leader Andromeda & BermudaOS 

Bart Kuivenhoven

unread,
Jun 19, 2012, 7:03:41 PM6/19/12
to orio...@googlegroups.com
Minix, a system in which inter process communication, in a distributed
OS, play an essential system role, seem to be handled with a couple
single threaded, simple list structures.

I don't know how much this has been optimized, or not, as it still is an
educational system, but the fact is that it works, and seems to work
well.

I don't know how well Minix' sockets scale (For efficiency sake, I hope
in Minix they scale well), but for a version like v0.1.3 it's more than
good enough.

As for the way Linux and BSD do things, I don't know well enough, as I
haven't been able to study those regions of those kernels yet.

--
Best regards; Met vriendelijke groet;
Bart Kuivenhoven.

Lead developer on the Andromeda project.



On Tue, 2012-06-19 at 19:48 +0200, Michel Megens wrote:
> Hi,
>
>
> Lets throw up a little (networking) discussion: How to let the
> net-core driver handle an incoming packet. I'm asking your
> opinions specifically on the following:
>
>
> * Handle packets thread based;
> * Handle packets not thread based;
> * Some other suggestion
> --
> You received this message because you are subscribed to the Google
> Groups "Orion" group.
> To post to this group, send an email to orio...@googlegroups.com.
> To unsubscribe from this group, send email to orion-os
> +unsub...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/orion-os?hl=en-GB.

Bart Kuivenhoven

unread,
Jun 19, 2012, 7:36:40 PM6/19/12
to orio...@googlegroups.com
On a second note, I found a library, that might help you answer the
question. It's called lwip, which is a light weight IP stack.

http://en.wikipedia.org/wiki/LwIP

I don't suggest you just put the code into the project, as there would
be some code that would become redundant, but this code certainly is
worth studying (I for one, am going to).

There's also another project by the same people called uIP, which is
aimed at 8/16 bit CPU's, which you might find interesting for the
BermudaOS project.

--
Best regards; Met vriendelijke groet;
Bart Kuivenhoven.

Lead developer on the Andromeda project.



On Tue, 2012-06-19 at 19:48 +0200, Michel Megens wrote:
> Hi,
>
>
> Lets throw up a little (networking) discussion: How to let the
> net-core driver handle an incoming packet. I'm asking your
> opinions specifically on the following:
>
>
> * Handle packets thread based;
> * Handle packets not thread based;
> * Some other suggestion
Reply all
Reply to author
Forward
0 new messages