Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #1238 > unrolled thread
| Started by | "aminer" <aminer@toto.com> |
|---|---|
| First post | 2012-11-28 16:21 -0600 |
| Last post | 2012-11-29 20:25 +0100 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.programming.threads
Distributed Reader-Writer Mutex 1.1 "aminer" <aminer@toto.com> - 2012-11-28 16:21 -0600
Re: Distributed Reader-Writer Mutex 1.1 "aminer" <aminer@toto.com> - 2012-11-28 20:47 -0600
Re: Distributed Reader-Writer Mutex 1.1 Anonymous <nobody@remailer.paranoici.org> - 2012-11-29 15:55 +0000
Re: Distributed Reader-Writer Mutex 1.1 "aminer" <aminer@toto.com> - 2012-11-28 21:08 -0600
Re: Distributed Reader-Writer Mutex 1.1 "aminer" <aminer@toto.com> - 2012-11-29 10:59 -0600
Re: Distributed Reader-Writer Mutex 1.1 Wilfried März <Wilfried.Maerz@gmx.at> - 2012-11-29 20:25 +0100
| From | "aminer" <aminer@toto.com> |
|---|---|
| Date | 2012-11-28 16:21 -0600 |
| Subject | Distributed Reader-Writer Mutex 1.1 |
| Message-ID | <k95v4d$brt$1@dont-email.me> |
Hello,
Distributed Reader-Writer Mutex was updated to version 1.1 , in this new
version it works both across processes and threads.
Description:
Distributed Reader-Writer Mutex, based on the Dmitry Vyukov C++ Distributed
Reader-Writer Mutex , that works across processe and threads, I have
included the following Reader-Writer Mutexes inside this Distributed
Reader-Writer mutex:
TMREW a light weight MREW lock (multiple-readers-exclusive-writer lock) that
is very fast and that works across processes and threads and
TMultiReadExclusiveWrite from JCL and now both of them can scale better, and
i have modified the Dmitry Vyukov Distributed Reader-Writer Mutex, in the
first version i have not used GetCurrentProcessor() but i have used
GetCurrentThreadID(), and i have also provided you with a second version
that scales better, to be able to use the second version please use the
version2 inside defines.inc, i have given you a test.pas example for the
first version and test1.pas for the second version, but don't forget to use
version2 inside defines.inc, to use the second version just uncomment the
version2 inside defines.inc and comment version1. I have also done a cache
line alignement in TOmniMREW, this has allowed Drwlock to scale better.
I have provided you with the source code, please take a look at the source
code to understand better.The Object Pascal Distributed Reader-Writer Mutex
is based on the following C++ Distributed Reader-Writer Mutex by Dmitry
Vyukov, read more here:
http://www.1024cores.net/home/lock-free-algorithms/reader-writer-problem/distributed-reader-writer-mutex
I have also modified the Dmitry Vyukov's Distributed Reader-Writer Mutex to
use a variable number of MREWs, you can pass the number of MREWs to the
constructor like this:
drw:=TDRWLOCK.create(100);
You have four methods:
procedure wlock; // same as EnterWriteLock of TOmniMREW
procedure wunlock; // same as ExitWriteLock
procedure rlock; // same as EnterReadLock
procedure runlock; // same as ExitReadLock
and you have to pass the number of MREWs(multiple-readers-exclusive-writer)
to the constructor like this:
drw:=TDRWLOCK.create(200); // here we are creating 200 MEWs
Here is some scalability numbers:
I have used TOmniMREW of the Omnithread library and used only
EnterReadLock() and ExitReadLock() with four threads on a quad cores and
TOmniMREW gave a negative scalability of -5.51x
And when i have used the second version of Distributed Reader-Writer Mutex
using only rlock() and runlock() , it gave me +3.94x scalability with four
threads on four cores. So now it's scaling.
And about the second version , don't forget to initialize the number that
you pass to rlock() and runlock() to 0 before calling rlock() and
runlock() .
In the previous versions i have aligned the array elements on cache line
bounderies like have done Dmitry Vyukov, and when i have tested the second
version it didn't work correctly , so i have thought about that and after
that i have decided to not align the array elements on cache line bounderied
but just add a cache line padding to TOmniMREW and this time it has worked
perfectly and now the second version is scaling perfectly..
Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/
Operating Systems: Win and Linux (x86).
Required FPC switches: -O3 -Sd -dFPC -dWin32 -dFreePascal
-Sd for delphi mode....
Required Delphi switches: -DMSWINDOWS -$H+
For Delphi 5,6,7 use -DDelphi
For Delphi 2005,2006,2007,2009,2010+ use the switch -DDELPHI2005+
And inside defines.inc you can use the following defines:
{$DEFINE CPU32} for 32 bits systems
{$DEFINE CPU64} for 64 bits systems
{$DEFINE TOmniMREW} to use Omnithread MREW
{$DEFINE TMultiReadExclusiveWrite} to use the jcl TMultiReadExclusiveWrite
You can download Distributed Reader-Writer Mutex 1.1 from:
http://pages.videotron.com/aminer/
Thank you,
Amine Mouklay Ramdane.
[toc] | [next] | [standalone]
| From | "aminer" <aminer@toto.com> |
|---|---|
| Date | 2012-11-28 20:47 -0600 |
| Message-ID | <k96epn$6ck$1@dont-email.me> |
| In reply to | #1238 |
Hello,
Distributed Reader-Writer Mutex was updated to version 1.11
GetCurrentProcessorNumber() was not working before cause
there was a bug with freepascal and lazarus, so i had to use
getcurrentid(), but i have found how to avoid this problem by setting the
calling convention to cdecl and putting the function inside another
function.
Like this:
---
function GetProcessorNumber:long;
function GetCurrentProcessorNumber:long;cdecl;
begin
asm
{$IFDEF CPU32}
mov eax, 1
CPUID
shr ebx, 24
mov eax, ebx
{$ENDIF CPU32}
{$IFDEF CPU64}
mov rax, 1
cpuid
shr rbx, 24
mov rax, rbx
{$ENDIF CPU64}
end;
end;
begin
result:=GetCurrentProcessorNumber;
end;
---
And now Distributed Reader-Writer Mutex 1.11 is working perfectly...
You can download it from:
http://pages.videotron.com/aminer/
Thank you,
Amine Moulay Ramdane.
"aminer" <aminer@toto.com> wrote in message
news:k95v4d$brt$1@dont-email.me...
> Hello,
>
>
> Distributed Reader-Writer Mutex was updated to version 1.1 , in this new
> version it works both across processes and threads.
>
>
> Description:
>
> Distributed Reader-Writer Mutex, based on the Dmitry Vyukov C++
> Distributed Reader-Writer Mutex , that works across processe and threads,
> I have included the following Reader-Writer Mutexes inside this
> Distributed Reader-Writer mutex:
>
> TMREW a light weight MREW lock (multiple-readers-exclusive-writer lock)
> that is very fast and that works across processes and threads and
> TMultiReadExclusiveWrite from JCL and now both of them can scale better,
> and i have modified the Dmitry Vyukov Distributed Reader-Writer Mutex, in
> the first version i have not used GetCurrentProcessor() but i have used
> GetCurrentThreadID(), and i have also provided you with a second version
> that scales better, to be able to use the second version please use the
> version2 inside defines.inc, i have given you a test.pas example for the
> first version and test1.pas for the second version, but don't forget to
> use version2 inside defines.inc, to use the second version just uncomment
> the version2 inside defines.inc and comment version1. I have also done a
> cache line alignement in TOmniMREW, this has allowed Drwlock to scale
> better.
>
> I have provided you with the source code, please take a look at the source
> code to understand better.The Object Pascal Distributed Reader-Writer
> Mutex is based on the following C++ Distributed Reader-Writer Mutex by
> Dmitry Vyukov, read more here:
>
> http://www.1024cores.net/home/lock-free-algorithms/reader-writer-problem/distributed-reader-writer-mutex
>
> I have also modified the Dmitry Vyukov's Distributed Reader-Writer Mutex
> to use a variable number of MREWs, you can pass the number of MREWs to the
> constructor like this:
> drw:=TDRWLOCK.create(100);
> You have four methods:
> procedure wlock; // same as EnterWriteLock of TOmniMREW
> procedure wunlock; // same as ExitWriteLock
> procedure rlock; // same as EnterReadLock
> procedure runlock; // same as ExitReadLock
>
> and you have to pass the number of
> MREWs(multiple-readers-exclusive-writer) to the constructor like this:
> drw:=TDRWLOCK.create(200); // here we are creating 200 MEWs
> Here is some scalability numbers:
>
> I have used TOmniMREW of the Omnithread library and used only
> EnterReadLock() and ExitReadLock() with four threads on a quad cores and
> TOmniMREW gave a negative scalability of -5.51x
>
> And when i have used the second version of Distributed Reader-Writer Mutex
> using only rlock() and runlock() , it gave me +3.94x scalability with four
> threads on four cores. So now it's scaling.
>
> And about the second version , don't forget to initialize the number that
> you pass to rlock() and runlock() to 0 before calling rlock() and
> runlock() .
>
> In the previous versions i have aligned the array elements on cache line
> bounderies like have done Dmitry Vyukov, and when i have tested the second
> version it didn't work correctly , so i have thought about that and after
> that i have decided to not align the array elements on cache line
> bounderied but just add a cache line padding to TOmniMREW and this time it
> has worked perfectly and now the second version is scaling perfectly..
>
> Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/
> Operating Systems: Win and Linux (x86).
> Required FPC switches: -O3 -Sd -dFPC -dWin32 -dFreePascal
> -Sd for delphi mode....
> Required Delphi switches: -DMSWINDOWS -$H+
> For Delphi 5,6,7 use -DDelphi
> For Delphi 2005,2006,2007,2009,2010+ use the switch -DDELPHI2005+
> And inside defines.inc you can use the following defines:
> {$DEFINE CPU32} for 32 bits systems
> {$DEFINE CPU64} for 64 bits systems
> {$DEFINE TOmniMREW} to use Omnithread MREW
>
> {$DEFINE TMultiReadExclusiveWrite} to use the jcl TMultiReadExclusiveWrite
>
>
>
> You can download Distributed Reader-Writer Mutex 1.1 from:
>
> http://pages.videotron.com/aminer/
>
>
>
>
> Thank you,
> Amine Mouklay Ramdane.
>
>
[toc] | [prev] | [next] | [standalone]
| From | Anonymous <nobody@remailer.paranoici.org> |
|---|---|
| Date | 2012-11-29 15:55 +0000 |
| Message-ID | <a8a6b02e75b994b6c473c54062ea2e65@remailer.paranoici.org> |
| In reply to | #1240 |
Hey you dogfaced pigfucker! Stop spamming usenet! > > http://arabgay.videogoat.fr/analer/ > > > > > > > > > > Spank you, > > Head goatfucker, Amine Mouklay Ramdane. > > > > > >
[toc] | [prev] | [next] | [standalone]
| From | "aminer" <aminer@toto.com> |
|---|---|
| Date | 2012-11-28 21:08 -0600 |
| Message-ID | <k96g0n$bso$1@dont-email.me> |
| In reply to | #1238 |
Hello,
Distributed Reader-Writer Mutex was updated to version 1.12
You don't have to specify the number of cores in the constructor, my library
will do it automaticly for you now.
You can download it from:
http://pages.videotron.com/aminer/
Thank you,
Amine Moulay Ramdane.
"aminer" <aminer@toto.com> wrote in message
news:k95v4d$brt$1@dont-email.me...
> Hello,
>
>
> Distributed Reader-Writer Mutex was updated to version 1.1 , in this new
> version it works both across processes and threads.
>
>
> Description:
>
> Distributed Reader-Writer Mutex, based on the Dmitry Vyukov C++
> Distributed Reader-Writer Mutex , that works across processe and threads,
> I have included the following Reader-Writer Mutexes inside this
> Distributed Reader-Writer mutex:
>
> TMREW a light weight MREW lock (multiple-readers-exclusive-writer lock)
> that is very fast and that works across processes and threads and
> TMultiReadExclusiveWrite from JCL and now both of them can scale better,
> and i have modified the Dmitry Vyukov Distributed Reader-Writer Mutex, in
> the first version i have not used GetCurrentProcessor() but i have used
> GetCurrentThreadID(), and i have also provided you with a second version
> that scales better, to be able to use the second version please use the
> version2 inside defines.inc, i have given you a test.pas example for the
> first version and test1.pas for the second version, but don't forget to
> use version2 inside defines.inc, to use the second version just uncomment
> the version2 inside defines.inc and comment version1. I have also done a
> cache line alignement in TOmniMREW, this has allowed Drwlock to scale
> better.
>
> I have provided you with the source code, please take a look at the source
> code to understand better.The Object Pascal Distributed Reader-Writer
> Mutex is based on the following C++ Distributed Reader-Writer Mutex by
> Dmitry Vyukov, read more here:
>
> http://www.1024cores.net/home/lock-free-algorithms/reader-writer-problem/distributed-reader-writer-mutex
>
> I have also modified the Dmitry Vyukov's Distributed Reader-Writer Mutex
> to use a variable number of MREWs, you can pass the number of MREWs to the
> constructor like this:
> drw:=TDRWLOCK.create(100);
> You have four methods:
> procedure wlock; // same as EnterWriteLock of TOmniMREW
> procedure wunlock; // same as ExitWriteLock
> procedure rlock; // same as EnterReadLock
> procedure runlock; // same as ExitReadLock
>
> and you have to pass the number of
> MREWs(multiple-readers-exclusive-writer) to the constructor like this:
> drw:=TDRWLOCK.create(200); // here we are creating 200 MEWs
> Here is some scalability numbers:
>
> I have used TOmniMREW of the Omnithread library and used only
> EnterReadLock() and ExitReadLock() with four threads on a quad cores and
> TOmniMREW gave a negative scalability of -5.51x
>
> And when i have used the second version of Distributed Reader-Writer Mutex
> using only rlock() and runlock() , it gave me +3.94x scalability with four
> threads on four cores. So now it's scaling.
>
> And about the second version , don't forget to initialize the number that
> you pass to rlock() and runlock() to 0 before calling rlock() and
> runlock() .
>
> In the previous versions i have aligned the array elements on cache line
> bounderies like have done Dmitry Vyukov, and when i have tested the second
> version it didn't work correctly , so i have thought about that and after
> that i have decided to not align the array elements on cache line
> bounderied but just add a cache line padding to TOmniMREW and this time it
> has worked perfectly and now the second version is scaling perfectly..
>
> Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/
> Operating Systems: Win and Linux (x86).
> Required FPC switches: -O3 -Sd -dFPC -dWin32 -dFreePascal
> -Sd for delphi mode....
> Required Delphi switches: -DMSWINDOWS -$H+
> For Delphi 5,6,7 use -DDelphi
> For Delphi 2005,2006,2007,2009,2010+ use the switch -DDELPHI2005+
> And inside defines.inc you can use the following defines:
> {$DEFINE CPU32} for 32 bits systems
> {$DEFINE CPU64} for 64 bits systems
> {$DEFINE TOmniMREW} to use Omnithread MREW
>
> {$DEFINE TMultiReadExclusiveWrite} to use the jcl TMultiReadExclusiveWrite
>
>
>
> You can download Distributed Reader-Writer Mutex 1.1 from:
>
> http://pages.videotron.com/aminer/
>
>
>
>
> Thank you,
> Amine Mouklay Ramdane.
>
>
[toc] | [prev] | [next] | [standalone]
| From | "aminer" <aminer@toto.com> |
|---|---|
| Date | 2012-11-29 10:59 -0600 |
| Message-ID | <k980mp$r1l$1@dont-email.me> |
| In reply to | #1238 |
Hello,
I have updated Distributed Reader-Writer Mutex to version 1.13,
i have saved and restored the ebx/rbx register in the
GetCurrentProcessorNumber inline assembler function, and now
it's working correctly.
You can download it from:
http://pages.videotron.com/aminer/
Thank you,
Amine Moulay Ramdane.
"aminer" <aminer@toto.com> wrote in message
news:k95v4d$brt$1@dont-email.me...
> Hello,
>
>
> Distributed Reader-Writer Mutex was updated to version 1.1 , in this new
> version it works both across processes and threads.
>
>
> Description:
>
> Distributed Reader-Writer Mutex, based on the Dmitry Vyukov C++
> Distributed Reader-Writer Mutex , that works across processe and threads,
> I have included the following Reader-Writer Mutexes inside this
> Distributed Reader-Writer mutex:
>
> TMREW a light weight MREW lock (multiple-readers-exclusive-writer lock)
> that is very fast and that works across processes and threads and
> TMultiReadExclusiveWrite from JCL and now both of them can scale better,
> and i have modified the Dmitry Vyukov Distributed Reader-Writer Mutex, in
> the first version i have not used GetCurrentProcessor() but i have used
> GetCurrentThreadID(), and i have also provided you with a second version
> that scales better, to be able to use the second version please use the
> version2 inside defines.inc, i have given you a test.pas example for the
> first version and test1.pas for the second version, but don't forget to
> use version2 inside defines.inc, to use the second version just uncomment
> the version2 inside defines.inc and comment version1. I have also done a
> cache line alignement in TOmniMREW, this has allowed Drwlock to scale
> better.
>
> I have provided you with the source code, please take a look at the source
> code to understand better.The Object Pascal Distributed Reader-Writer
> Mutex is based on the following C++ Distributed Reader-Writer Mutex by
> Dmitry Vyukov, read more here:
>
> http://www.1024cores.net/home/lock-free-algorithms/reader-writer-problem/distributed-reader-writer-mutex
>
> I have also modified the Dmitry Vyukov's Distributed Reader-Writer Mutex
> to use a variable number of MREWs, you can pass the number of MREWs to the
> constructor like this:
> drw:=TDRWLOCK.create(100);
> You have four methods:
> procedure wlock; // same as EnterWriteLock of TOmniMREW
> procedure wunlock; // same as ExitWriteLock
> procedure rlock; // same as EnterReadLock
> procedure runlock; // same as ExitReadLock
>
> and you have to pass the number of
> MREWs(multiple-readers-exclusive-writer) to the constructor like this:
> drw:=TDRWLOCK.create(200); // here we are creating 200 MEWs
> Here is some scalability numbers:
>
> I have used TOmniMREW of the Omnithread library and used only
> EnterReadLock() and ExitReadLock() with four threads on a quad cores and
> TOmniMREW gave a negative scalability of -5.51x
>
> And when i have used the second version of Distributed Reader-Writer Mutex
> using only rlock() and runlock() , it gave me +3.94x scalability with four
> threads on four cores. So now it's scaling.
>
> And about the second version , don't forget to initialize the number that
> you pass to rlock() and runlock() to 0 before calling rlock() and
> runlock() .
>
> In the previous versions i have aligned the array elements on cache line
> bounderies like have done Dmitry Vyukov, and when i have tested the second
> version it didn't work correctly , so i have thought about that and after
> that i have decided to not align the array elements on cache line
> bounderied but just add a cache line padding to TOmniMREW and this time it
> has worked perfectly and now the second version is scaling perfectly..
>
> Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/
> Operating Systems: Win and Linux (x86).
> Required FPC switches: -O3 -Sd -dFPC -dWin32 -dFreePascal
> -Sd for delphi mode....
> Required Delphi switches: -DMSWINDOWS -$H+
> For Delphi 5,6,7 use -DDelphi
> For Delphi 2005,2006,2007,2009,2010+ use the switch -DDELPHI2005+
> And inside defines.inc you can use the following defines:
> {$DEFINE CPU32} for 32 bits systems
> {$DEFINE CPU64} for 64 bits systems
> {$DEFINE TOmniMREW} to use Omnithread MREW
>
> {$DEFINE TMultiReadExclusiveWrite} to use the jcl TMultiReadExclusiveWrite
>
>
>
> You can download Distributed Reader-Writer Mutex 1.1 from:
>
> http://pages.videotron.com/aminer/
>
>
>
>
> Thank you,
> Amine Mouklay Ramdane.
>
>
[toc] | [prev] | [next] | [standalone]
| From | Wilfried März <Wilfried.Maerz@gmx.at> |
|---|---|
| Date | 2012-11-29 20:25 +0100 |
| Message-ID | <k98crk$56h$1@speranza.aioe.org> |
| In reply to | #1243 |
Stop spamming this newsgroup, stupid!
[toc] | [prev] | [standalone]
Back to top | Article view | comp.programming.threads
csiph-web