lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Making lwIP thread safe


From: address@hidden
Subject: Re: [lwip-users] Making lwIP thread safe
Date: Sun, 20 Apr 2008 22:09:30 +0200
User-agent: Thunderbird 2.0.0.12 (Macintosh/20080213)

Just to clarify this: lwIP's core is (intentionally) not thread-safe: It should be small to be used without an OS. If you want to use it from different threads, you cannot use the raw api, use the netconn or sockets api instead (if anyone doesn't know what that is, read about it at http://lwip.scribblewiki.com/). Thus lwIP _is_ thread safe if you want it to.

That said, if I understand you correctly, you want to run 200 full instances of lwIP in one process: that doesn't work (also, intentionally): many parts in lwIP use global or static variables (the whole stack is _not_ reentrant). After all, running lwIP in a process is much like running it on its own device (a completely seperate address space). Running 2 instances in 2 different threads in the same process is like running it twice on the same device: you could make it work with a high effort, but there's no use for that in normal life...

Simon


Bob McConnell wrote:
Looking through the list archives, I get the impression that lwIP is not fully thread safe. How much work will be involved to correct this problem, and is anyone working on it now?

Why? I have a project to prototype a test bench at work that requires multiple instances of a TCP/IP stack connecting to TUN/TAP devices on FreeBSD or Linux to emulate a network of embedded devices. The host OS will act as a firewall/router and each instance of the stack will have a unique IP address. The goal is to emulate a couple thousand devices. I would like to build a prototype that creates 200 instances using pthreads. I can probably do it with 200 processes, but that will be much more difficult to control and manage. The network traffic will also be channeled through Dummynet for reliability and performance testing.

I have some related questions about keep-alive configurations, but will send them separately.

Thank you,

Bob McConnell
N2SPP


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users






reply via email to

[Prev in Thread] Current Thread [Next in Thread]