[concurrency-interest] Concurrent indexed queue

Rohit Reja rreja2000 at yahoo.com
Wed Aug 24 12:10:02 EDT 2011


 Hi Aleksey, 

 To clarify a bit further, I dont need to keep any history of quotes, I just need to keep the latest quote for an instrument. 

So for e.g. One of the possible solution that i thought was to keep a CHM of instrumentid (key) and quote(value).
And an event queue of "instrumentids". so lets say events comes as 
E1( I1, Q1)
E2(I2, q1)
E3(I1, Q2)
 
Then CHM will have 2 entries. While the Queue will have 3 entries {I1, I2, I1}. 
Now when consumer consumes I1 it removes I1's entry from CHM, so that consumer can ignore the event 
I1 next time when it retrieves I1 from queue. 

This implementation would cause the event queue to grow indefinetely as the consumer is slower.
To avoid this , I can simply check if I1 is contained in the queue before putting in queue but that would make things definetely very slow.

I hope I have made things clearer now.

Thanks,
rohit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20110824/f4fcc18c/attachment.html>


More information about the Concurrency-interest mailing list