Why atomic stuff rules :)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Why atomic stuff rules :)

Igor Stasenko
In the attachment an implementation of SharedQueue3, which using
atomic operation.
Of course , currently it is based on assumption that some stuff (like
two assignments in a row) can't be interrupted.

The FIFO implementation using ASWP and CAS:

push:
 - no spins, 1 ASWP

pop:
 - 2 spins, 1 ASWP , 1 CAS


Here a simple bench i made, which pushing 100000 elements into queue
using 10 different processes,
and then looks how many are popped via 3 feeder processes during that time:

Squeak VM.

SharedQueue :

SharedQueue3Test new benchManyPushersAndFeeders: SharedQueue
'Added 100000 items, processed 30000 queue items during 1928 milliseconds'

SharedQueue2 :

SharedQueue3Test new benchManyPushersAndFeeders: SharedQueue2
'Added 100000 items, processed 30034 queue items during 1074 milliseconds'

SharedQueue3 (mine) :

SharedQueue3Test new benchManyPushersAndFeeders: SharedQueue3
'Added 100000 items, processed 70229 queue items during 118 milliseconds'


Cog:

SharedQueue3Test new benchManyPushersAndFeeders: SharedQueue
 'Added 100000 items, processed 29999 queue items during 1955 milliseconds'

SharedQueue3Test new benchManyPushersAndFeeders: SharedQueue2
'Added 100000 items, processed 29997 queue items during 197 milliseconds'

SharedQueue3Test new benchManyPushersAndFeeders: SharedQueue3
'Added 100000 items, processed 100000 queue items during 26 milliseconds'


if anyone has better ideas how to bench throughput, send me the code.


--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

atomic queue.zip (3K) Download Attachment