You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by de...@avalon.apache.org on 2004/08/15 22:23:20 UTC
[jira] Created: (RUNTIME-51) SimpleFIFO in Merlin implementation wastes CPU cycles
Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/RUNTIME-51
Here is an overview of the issue:
---------------------------------------------------------------------
Key: RUNTIME-51
Summary: SimpleFIFO in Merlin implementation wastes CPU cycles
Type: Improvement
Status: Open
Priority: Major
Project: Merlin Runtime
Components:
CORE
Versions:
3.4.0
Assignee: Stephen McConnell
Reporter: Carel Paradis
Created: Sun, 15 Aug 2004 1:22 PM
Updated: Sun, 15 Aug 2004 1:22 PM
Description:
The class SimpleFifo in the Merlin implementation wastes CPU cycles every 100 ms. The method get verify if the queue is no longer empty every 100 ms instead of waiting to be notified when a new element is added to the queue. Also, the put method notifies all waiting threads instead of notifying only one thread. It is not necessary to notify all threads because if many threads are waiting, then only one can get the newly added element.
The following file must be updated: trunk\runtime\merlin\impl\src\java\org\apache\avalon\merlin\impl\SimpleFIFO.java
Apply the following patch:
// -----BEGIN PATCH
Index: SimpleFIFO.java
===================================================================
--- SimpleFIFO.java (revision 36413)
+++ SimpleFIFO.java (working copy)
@@ -42,7 +42,7 @@
synchronized( this )
{
m_Queue.add( obj );
- notifyAll();
+ notify();
}
}
@@ -52,7 +52,7 @@
synchronized( this )
{
while( m_Queue.size() == 0 )
- wait(100);
+ wait();
return m_Queue.remove(0);
}
}
// -----END PATCH
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org
[jira] Closed: (RUNTIME-51) SimpleFIFO in Merlin implementation wastes CPU cycles
Posted by de...@avalon.apache.org.
Message:
The following issue has been closed.
Resolver: Niclas Hedhman
Date: Sat, 4 Sep 2004 3:55 AM
The amount of CPU cycles "wasted" is neglible. Combined with the extra "safety" against deadlocks, I intend to keep the current implementation.
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/RUNTIME-51
Here is an overview of the issue:
---------------------------------------------------------------------
Key: RUNTIME-51
Summary: SimpleFIFO in Merlin implementation wastes CPU cycles
Type: Improvement
Status: Closed
Priority: Major
Resolution: WON'T FIX
Project: Merlin Runtime
Components:
CORE
Versions:
3.4.0
Assignee: Stephen McConnell
Reporter: Carel Paradis
Created: Sun, 15 Aug 2004 1:22 PM
Updated: Sat, 4 Sep 2004 3:55 AM
Description:
The class SimpleFifo in the Merlin implementation wastes CPU cycles every 100 ms. The method get verify if the queue is no longer empty every 100 ms instead of waiting to be notified when a new element is added to the queue. Also, the put method notifies all waiting threads instead of notifying only one thread. It is not necessary to notify all threads because if many threads are waiting, then only one can get the newly added element.
The following file must be updated: trunk\runtime\merlin\impl\src\java\org\apache\avalon\merlin\impl\SimpleFIFO.java
Apply the following patch:
// -----BEGIN PATCH
Index: SimpleFIFO.java
===================================================================
--- SimpleFIFO.java (revision 36413)
+++ SimpleFIFO.java (working copy)
@@ -42,7 +42,7 @@
synchronized( this )
{
m_Queue.add( obj );
- notifyAll();
+ notify();
}
}
@@ -52,7 +52,7 @@
synchronized( this )
{
while( m_Queue.size() == 0 )
- wait(100);
+ wait();
return m_Queue.remove(0);
}
}
// -----END PATCH
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org