Problem identification problem :D

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2009
Posts: 22
Reputation: dumrat is an unknown quantity at this point 
Solved Threads: 0
dumrat dumrat is offline Offline
Newbie Poster

Problem identification problem :D

 
0
  #1
Jul 27th, 2009
Hi,
I was assigned to study and understand some code and I was told the major problem with the program was poor performance.
Here's the bottleneck:
A global data set is maintained. This data set is updated regularly. Then there are threads that have to do some processing using a snapshot of the dataset after each update. The processing threads do not change the dataset but they require that no one else changes the dataset while they are evaluating as well. This means that the dataset cannot be updated (Which in turn means that the processing threads can't process using the updated dataset) while the threads are processing - which is the bottleneck as the update rate for the dataset is high.
I can think of couple of ways of improving the performance, but I feel pretty certain that this is a common problem. I would like to know the name of this problem if this is indeed a common problem. (So I can Google). Or suggestions on how to improve performance.

Currently I thought of two methods:
1. Maintain 2 or more data sets that are identical. Update one data set(A) when the other(B) is used by processing threads. then update B using A with a dedicated thread?

2. Incremental updating of data set? Keep a separate list of updates and the dataset. When updating, add to the list. When processing, use both the list's data and dataset. periodically update dataset with the list. (This is again like the first method)

Thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Problem identification problem :D

 
0
  #2
Jul 27th, 2009
Both sound reasonable approaches.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 10
Reputation: harryhaaren is an unknown quantity at this point 
Solved Threads: 1
harryhaaren harryhaaren is offline Offline
Newbie Poster

Re: Problem identification problem :D

 
0
  #3
Jul 30th, 2009
Hey,

I think what your looking for is called a Mutex, or Mutual Exclusion.
Simple example: If something is TRUE, its obviously NOT FALSE. So FALSE is mutually excluded if something is TRUE. In the same way there are ways to Mutex two (or more) processes.

Hope this is any good to you! -Harry
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 22
Reputation: dumrat is an unknown quantity at this point 
Solved Threads: 0
dumrat dumrat is offline Offline
Newbie Poster

Re: Problem identification problem :D

 
0
  #4
Jul 30th, 2009
Nope. Not looking for mutexes . What I want is to be able to write to a data set while many threads are reading from it. the reading threads require that the data set remain unchanged during their processing. This is obviously made simple by using mutexes- unfortunately I can't use it because then the performance would suck.

i.e. Update rate is 100 updates/s, 25 threads, 5 processings per sec per thread.
What happens if I lock the data set is that the effective processing rate of the system drops to 5.

Anyone know a name for this mess?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Problem identification problem :D

 
0
  #5
Jul 30th, 2009
Well the first one is basically called double buffering.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum


Views: 323 | Replies: 4
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC