lwip-members
[Top][All Lists]
Advanced

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

Re: [lwip-members] question about SYS_ARCH_ defines


From: David Haas
Subject: Re: [lwip-members] question about SYS_ARCH_ defines
Date: Tue, 18 Feb 2003 10:26:13 -0500
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.2b) Gecko/20021107

Well, I guess I disagree.

Protection should be put where it is necessary at a low layer (although we should be coding to minimize those spots). Otherwise you wind up with your entire task protected, causing too much inter-task latency. Are we going to protect the entire tcp task? It's an option, but it would make lwip totally unsuitable for a small embedded system which uses an OS and has some real-time requirements.

I think lwip has the approach of pushing the protection out into the sys_arch stuff. This gives users lots of flexability. In fact if you want to protect your tasks completely, you could, by specifying that in sys_thread_new().

My implementation for lightweight protection for unix uses mutex and does not assume that they support recursive calls. A counter is implemented outside of the mutex. Would it work for uCOS?

I admit there are risks for deadlock. I actually fixed a deadlock problem I had with select() (I submitted it already).

Regards,
David.


address@hidden wrote:

Hello,

my thoughts on protection are as follows:

Do not implement locking in the lwIP core files, because
we simply cannot implement all the different protection
schemes used by different operating systems.

Implement locking in the higher layers.

The benefit is that lwIP is not cluttered with different protection
schemes.
The drawback is that locking critical sections occurs at a more coarse
grained level.
The benefit is that we do not have deadlock (are your mutexes recursive??).
For example, uCOS does not support recursive mutexes.

If a task enters a critical section, then calls another function entering
the
same critical section (for example pbuf management), the protection mutex
is not recursed and deadlock occurs.

I would strongly opt for removing all locking primitives/macro's from the
core lwIP API to improve stack maintainability. I think this would break
a lot of stuff out there though...

Regards,

Leon Woestenberg




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








reply via email to

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