Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #2145

Reread please...

From aminer <aminer@toto.net>
Newsgroups comp.programming.threads
Subject Reread please...
Date 2014-04-11 20:51 -0700
Organization albasani.net
Message-ID <lia2ll$65o$1@news.albasani.net> (permalink)

Show all headers | View raw


Reread please i have corrected some typos...


Hello,


We have to be smart please, as you have noticed i have
wrote another scalable FIFO fair lock and i have
studied it deeply , and i have come to the conclusion
that it's useful to learn and useful to use, i have
began to test it under contention to see how it behave,
under contention with 2 threads on a Quadcore and
under contention with 4 threads, what i have
discovered that under contention with two threads
the following section in the Enter() method
will be accessed by 1/2 of the total  number of times the threads enter 
the Enter() method.

here is the section, it is when PMyRecord4(a)^.myid equal -1:

if PMyRecord4(a)^.myid=0
           then
            begin
             PMyRecord4(a)^.count:=1;
             exit;
             end
          else
          begin
           freemem(PMyRecord4(a)^.mem); <- this one
           end;
       end

but under contention with 4 threads this same section
will be accessed almost 0 times.. so if you want to test
the scalability with  two threads scenario under contention,
you will not be able to do it accuratly cause under contention
with two threads the queue.pop(tobject(a)) statement inside the Enter() 
method will be cheap compared to the 4 threads scenario under 
contention, but what i can tell you for sure is that with 4 threads and 
more and with more cores and under contention my FIFO fair lock
will be scalable.

But we have to be smart more than that, you will say that my
scalable FIFO fair lock is slower by almost 2x times than the
Ticket spinlock with a proportional backoff, but you have
to understand that the TicketSpinlock will not scale with
bigger critical sections ,  my scalable FIFO fair lock
will, other than that you have to understand that as the time
inside the  critical section becomes bigger the speed
of my scalable FIFO fair lock will be almost equal to that of
the TicketSpinlock with a proportional backoff, other than
that, to make my scalable FIFO fair lock faster you can use
a Waitfree FIFO queue on the pop side of the queue.

You can download my scalable FIFO fair lock from:

http://pages.videotron.com/aminer/




Thank you,
Amine Moulay Ramdane.

Back to comp.programming.threads | Previous | Next | Find similar | Unroll thread


Thread

Reread please... aminer <aminer@toto.net> - 2014-04-11 20:51 -0700

csiph-web