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: Mon, 21 Apr 2008 20:21:59 +0200
User-agent: Thunderbird 2.0.0.12 (Macintosh/20080213)

Jonathan Larmour wrote:
Bob McConnell wrote:
address@hidden wrote:
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...
I knew there was one large company in the Northwest USA that doesn't
believe testing is part of normal life, but I wasn't aware that everyone
believed that.
I didn't say I wouldn't test if I was developing a product using lwIP. All I said was if I would test, I wouldn't try to run software in multiple threads inside one process if it's normally running in completely seperate devices.
 Be that as it may, many devices need multiple stacks
running, for example one for a network interface and a second for ppp on
a serial port.
I don't really know why you would need multiple stacks to have more than one network interface., maybe you can explain this to me? Why don't you simply use 2 interfaces on one instance of the stack?
 This can be done with Rabbits and PICs, so it should
qualify as a valid target. I believe you have taken much too narrow a
view of normal life.

lwIP supports multiple network interfaces - the normal, and reasonable
expectation, is that nothing in lwIP prevents you having a single stack
with both an ethernet and ppp interface. That being said....

But I also think you misread my description. I need 2000 full instances
running simultaneously. Only the prototype may be limited to 200. Each
Got that.
instance must emulate one of several different devices and open a
permanent TCP connection with a transaction server using a unique IP
source address. This eliminates UML and VMWare as hosts, since they
cannot support anywhere near that many sessions. It is not possible to
set up that many devices  in our facility, even if we emptied out the
entire warehouse to make room for them.
 Perhaps you can suggest some
other way to implement this test bench?
I think you have two possibilities:

a) use 2000 processes (on windows or some kind of unix - e.g. linux or macos), each running a copy of lwIP. The advantage of this solution is that you have completely seperate address spaces for each device simulation - much like the software running on the device: that way you make sure one instance doesn't interfere with the others (you don't get that with pthreads!). Of course, processes are not as lightweight as threads, but an up-to-date PC should be able to run at least a few hundred or maybe even all (depending on the speed you need, you can use more than one PC for simulation).

b) use 2000 netifs in a single process. Like Jonathan said, lwIP is _not_ designed for this amount of netifs (lw stands for lightweight). The big disadvantage is that you can't completely simulate your software: you have to design it in a way that it can be run with its own stack (in the device) _or_ with a shared stack. That way, you can't fully test the software because it is different when run in the device.

In any case, you can take a look at the contrib folder in the CVS repository: there are ports for windows and unix/linux you can use to run lwIP on a PC (each process or netif can have its own IP; 'bridged' to the real network).

Supporting that many interfaces simultaneously is not a particularly narrow
view - it's extremely unusual. lwIP, being lightweight, would not be well
optimised for the case of 2000 netifs. netifs are held on a list which is
processed in a simple linear way.

But on the other hand, you talk about "Rabbits and PICs", so does that mean
each copy of lwIP would run on its own processor in its own address space?
As I understand it, that's the case. Bob, please correct me if I'm wrong.

Hope that helps,

Simon




reply via email to

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