[asterisk-bugs] [Asterisk 0013011]: [patch] find_idle_thread() uses spin wait

noreply at bugs.digium.com noreply at bugs.digium.com
Mon Jul 7 14:11:34 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13011 
====================================================================== 
Reported By:                jpgrayson
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   13011
Category:                   Channels/chan_iax2
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             07-07-2008 14:01 CDT
Last Modified:              07-07-2008 14:11 CDT
====================================================================== 
Summary:                    [patch] find_idle_thread() uses spin wait
Description: 
When find_idle_thread() creates a new dynamic thread, it spins waiting for
the newly created thread to "signal" that it is up, running, and ready to
go. On a lightly loaded system, the child thread will be scheduled promptly
and the parent thread will thus probably not spin too much.

On a heavily loaded system, it might be possible for the parent thread to
be rescheduled many times prior to the child thread becoming ready. This is
a waste of CPU when the system can least afford it.

Instead of spin waiting, a condition variable can be used. This would make
the parent thread efficiently block until the child thread becomes ready.
====================================================================== 

---------------------------------------------------------------------- 
 jpgrayson - 07-07-08 14:11  
---------------------------------------------------------------------- 
The attached patch replaces the find_idle_thread() spin wait with a
condition variable.

Note that this also removes the odd-ball use of bitfield with the
ready_for_signal variable. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-07-08 14:11  jpgrayson      Note Added: 0089848                          
======================================================================




More information about the asterisk-bugs mailing list