This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello, I've attached a proposed improvement, developed by Alex Paulis and myself, in the implementation of select(). We had found that with many threads using select, a significant fraction of CPU time was occupied by tasks unnecessarily woken up. As the comments in the original note, "...We just wake up all threads waiting, regardless of whether they are waiting for this event or not. This avoids any race conditions, and is consistent with the behaviour of the BSD kernel." With the patch in place, a reduction by as much as 20% in the CPU load has been noted, along with a response time reduction of nearly 50% in some cases. Obviously these are very situation specific numbers. The patch makes three basic changes to select: 1. The simplest was to streamline iterating through the masks, in lines 213 to 221 (which rely on the calls to FD_ENFORCE above). Previously there were 256 divides and 256 modulos computed per fd_set. 2. Only threads waiting on a specific fd are woken up when that fd becomes available. Each thread waits on one bit of an event flag (bit number = thread id modulo 32) rather than a condition variable. sel_record() or's together all bits for threads waiting on a device and sel_wakeup() sets only those bits of threads waiting on that device. 3. The mutex is no longer required, eliminating the overhead of locking and unlocking it (though the scheduler is still locked and unlocked to protect si_waitFlag). We've tested the patch under various loads with a number of devices on the i386 platform and an arm7TDMI. WaveRider has recently started using eCos for one of our embedded products and we have had a great experience with it so far. We appreciate the contributions made by so many and hope that this is the first of many we can make. I'm not clear what the current situation is with copyright assignments (FSF or eCosCentric), but we are willing to sign one. Cameron Taylor Technology Analysis Engineer WaveRider Communications
Attachment:
patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |