wth -- Thread time .vs Subroutine time
-
- Posts: 4292
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: wth -- Thread time .vs Subroutine time
'ptrBaseBuffer1' and 'ptrBaseBuffer1plus' are fixed until a buffer becomes exhausted when we go back to Sub SwitchBuffer.
-
- Posts: 4292
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: wth -- Thread time .vs Subroutine time
@fxm
I saved the code " the current version of 'ThreadPooling' " into a file called A.txt. I saved the code " the new version of 'ThreadPooling' " into a file called B.txt.
My text editor, TextPad, has a facility to compare txt files.
Yes, B.txt had references to _mutex3 and used memmove that A.txt did not have. However, there were some statements in A.txt which I would have thought should have carried over into B.txt.
Now I am no way near to fully understanding your code, but I am now wondering whether one or more statements have been inadvertently removed from A that are still required in B.
If you do a txt comparison you may spot something quickly.
I went back to the post Feb 13.Yours truly wrote:In your post Feb 13, 2021 where you use " the current version of 'ThreadPooling' " and " the new version of 'ThreadPooling' " I put the new version to PractRand and got a catastrophic failure at 256MB; three times.
I saved the code " the current version of 'ThreadPooling' " into a file called A.txt. I saved the code " the new version of 'ThreadPooling' " into a file called B.txt.
My text editor, TextPad, has a facility to compare txt files.
Yes, B.txt had references to _mutex3 and used memmove that A.txt did not have. However, there were some statements in A.txt which I would have thought should have carried over into B.txt.
Now I am no way near to fully understanding your code, but I am now wondering whether one or more statements have been inadvertently removed from A that are still required in B.
If you do a txt comparison you may spot something quickly.
Re: wth -- Thread time .vs Subroutine time
I have demonstrated by test a case of blocking for the version that you call "pre mutex3".
This is due to the line:
If pThis->_end = 1 And Ubound(pThis->_pThread) = 0 Then Exit Sub
where the shared variable 'pThis->_pThread' is accessed without mutex exclusion with 'PoolingSubmit'.
Similar code for the version "new".
I corrected this bug (in both '_Thread').
- Version "pre _mutex3" + correction "blocking":
- Version "pre _mutex3" + correction "blocking" + change #2 (but not change #1):
For the moment, I do not include the change #1 (use of 'memmove') because I have still a doubt on 'memmove' when multi-threading.
If you had the time and the inclination to try both, I would be grateful.
This is due to the line:
If pThis->_end = 1 And Ubound(pThis->_pThread) = 0 Then Exit Sub
where the shared variable 'pThis->_pThread' is accessed without mutex exclusion with 'PoolingSubmit'.
Similar code for the version "new".
I corrected this bug (in both '_Thread').
- Version "pre _mutex3" + correction "blocking":
Code: Select all
Type ThreadPooling '' Version "pre _mutex3" + correction "blocking"
Public:
Declare Constructor()
Declare Sub PoolingSubmit(Byval pThread As Function(Byval As Any Ptr) As String, Byval p As Any Ptr = 0)
Declare Sub PoolingWait()
Declare Sub PoolingWait(values() As String)
Declare Property PoolingState() As Ubyte
Declare Destructor()
Private:
Dim As Function(Byval p As Any Ptr) As String _pThread0
Dim As Any Ptr _p0
Dim As Function(Byval p As Any Ptr) As String _pThread(Any)
Dim As Any Ptr _p(Any)
Dim As Any Ptr _mutex1
Dim As Any Ptr _mutex2
Dim As Any Ptr _pt
Dim As Byte _end
Dim As String _returnF(Any)
Dim As Ubyte _state
Declare Static Sub _Thread(Byval p As Any Ptr)
End Type
Constructor ThreadPooling()
Redim This._pThread(0)
Redim This._p(0)
Redim This._returnF(0)
This._mutex1 = Mutexcreate()
This._mutex2 = Mutexcreate()
Mutexlock(This._mutex2)
This._pt= Threadcreate(@ThreadPooling._Thread, @This)
End Constructor
Sub ThreadPooling.PoolingSubmit(Byval pThread As Function(Byval As Any Ptr) As String, Byval p As Any Ptr = 0)
Mutexlock(This._mutex1)
If Ubound(This._pThread) = 0 Then
Mutexunlock(This._mutex2)
End If
Redim Preserve This._pThread(Ubound(This._pThread) + 1)
This._pThread(Ubound(This._pThread)) = pThread
Redim Preserve This._p(Ubound(This._p) + 1)
This._p(Ubound(This._p)) = p
Mutexunlock(This._mutex1)
This._state = 1
End Sub
Sub ThreadPooling.PoolingWait()
This._end = 1
Mutexunlock(This._mutex2)
.ThreadWait(This._pt)
This._end = 0
Redim This._returnF(0)
This._state = 0
This._pt= Threadcreate(@ThreadPooling._Thread, @This)
End Sub
Sub ThreadPooling.PoolingWait(values() As String)
This._end = 1
Mutexunlock(This._mutex2)
.ThreadWait(This._pt)
This._end = 0
If Ubound(This._returnF) > 0 Then
Redim values(1 To Ubound(This._returnF))
For I As Integer = 1 To Ubound(This._returnF)
values(I) = This._returnF(I)
Next I
Redim This._returnF(0)
Else
Erase values
End If
This._state = 0
This._pt= Threadcreate(@ThreadPooling._Thread, @This)
End Sub
Property ThreadPooling.PoolingState() As Ubyte
Return This._state
End Property
Sub ThreadPooling._Thread(Byval p As Any Ptr)
Dim As ThreadPooling Ptr pThis = p
Dim As Integer ub
Do
Mutexlock(pThis->_mutex1)
While ub = 0
Mutexunlock(pThis->_mutex1)
pThis->_state = 4
Mutexlock(pThis->_mutex2)
If pThis->_end = 1 Then Exit Sub
Mutexlock(pThis->_mutex1)
ub = Ubound(pThis->_pThread)
Wend
pThis->_pThread0 = pThis->_pThread(1)
pThis->_p0 = pThis->_p(1)
For I As Integer = 2 To Ubound(pThis->_pThread)
pThis->_pThread(I - 1) = pThis->_pThread(I)
pThis->_p(I - 1) = pThis->_p(I)
Next I
Redim Preserve pThis->_pThread(Ubound(pThis->_pThread) - 1)
Redim Preserve pThis->_p(Ubound(pThis->_p) - 1)
ub = Ubound(pThis->_pThread)
Mutexunlock(pThis->_mutex1)
Redim Preserve pThis->_ReturnF(Ubound(pThis->_returnF) + 1)
pThis->_state = 2
pThis->_returnF(Ubound(pThis->_returnF)) = pThis->_pThread0(pThis->_p0)
Loop
End Sub
Destructor ThreadPooling()
This._end = 1
Mutexunlock(This._mutex2)
.ThreadWait(This._pt)
Mutexdestroy(This._mutex1)
Mutexdestroy(This._mutex2)
End Destructor
Code: Select all
Type ThreadPooling '' Version "pre _mutex3" + correction "blocking" + change #2 (but not change #1)
Public:
Declare Constructor()
Declare Sub PoolingSubmit(Byval pThread As Function(Byval As Any Ptr) As String, Byval p As Any Ptr = 0)
Declare Sub PoolingWait()
Declare Sub PoolingWait(values() As String)
Declare Property PoolingState() As Ubyte
Declare Destructor()
Private:
Dim As Function(Byval p As Any Ptr) As String _pThread0
Dim As Any Ptr _p0
Dim As Function(Byval p As Any Ptr) As String _pThread(Any)
Dim As Any Ptr _p(Any)
Dim As Any Ptr _mutex1
Dim As Any Ptr _mutex2
Dim As Any Ptr _mutex3
Dim As Any Ptr _pt
Dim As Byte _end
Dim As String _returnF(Any)
Dim As Ubyte _state
Declare Static Sub _Thread(Byval p As Any Ptr)
End Type
Constructor ThreadPooling()
Redim This._pThread(0)
Redim This._p(0)
Redim This._returnF(0)
This._mutex1 = Mutexcreate()
This._mutex2 = Mutexcreate()
Mutexlock(This._mutex2)
This._mutex3 = Mutexcreate()
Mutexlock(This._mutex3)
This._pt= Threadcreate(@ThreadPooling._Thread, @This)
End Constructor
Sub ThreadPooling.PoolingSubmit(Byval pThread As Function(Byval As Any Ptr) As String, Byval p As Any Ptr = 0)
Mutexlock(This._mutex1)
If Ubound(This._pThread) = 0 Then
Mutexunlock(This._mutex2)
End If
Redim Preserve This._pThread(Ubound(This._pThread) + 1)
This._pThread(Ubound(This._pThread)) = pThread
Redim Preserve This._p(Ubound(This._p) + 1)
This._p(Ubound(This._p)) = p
Mutexunlock(This._mutex1)
This._state = 1
End Sub
Sub ThreadPooling.PoolingWait()
Mutexlock(This._mutex3)
Redim This._returnF(0)
This._state = 0
Mutexunlock(This._mutex3)
End Sub
Sub ThreadPooling.PoolingWait(values() As String)
Mutexlock(This._mutex3)
If Ubound(This._returnF) > 0 Then
Redim values(1 To Ubound(This._returnF))
For I As Integer = 1 To Ubound(This._returnF)
values(I) = This._returnF(I)
Next I
Redim This._returnF(0)
Else
Erase values
End If
This._state = 0
Mutexunlock(This._mutex3)
End Sub
Property ThreadPooling.PoolingState() As Ubyte
Return This._state
End Property
Sub ThreadPooling._Thread(Byval p As Any Ptr)
Dim As ThreadPooling Ptr pThis = p
Dim As Integer ub
Do
Mutexlock(pThis->_mutex1)
While ub = 0
Mutexunlock(pThis->_mutex3)
Mutexunlock(pThis->_mutex1)
pThis->_state = 4
Mutexlock(pThis->_mutex2)
If pThis->_end = 1 Then Exit Sub
Mutexlock(pThis->_mutex1)
ub = Ubound(pThis->_pThread)
Mutexlock(pThis->_mutex3)
Wend
pThis->_pThread0 = pThis->_pThread(1)
pThis->_p0 = pThis->_p(1)
For I As Integer = 2 To Ubound(pThis->_pThread)
pThis->_pThread(I - 1) = pThis->_pThread(I)
pThis->_p(I - 1) = pThis->_p(I)
Next I
Redim Preserve pThis->_pThread(Ubound(pThis->_pThread) - 1)
Redim Preserve pThis->_p(Ubound(pThis->_p) - 1)
ub = Ubound(pThis->_pThread)
Mutexunlock(pThis->_mutex1)
Redim Preserve pThis->_ReturnF(Ubound(pThis->_returnF) + 1)
pThis->_state = 2
pThis->_returnF(Ubound(pThis->_returnF)) = pThis->_pThread0(pThis->_p0)
Loop
End Sub
Destructor ThreadPooling()
This._end = 1
Mutexunlock(This._mutex2)
.ThreadWait(This._pt)
Mutexdestroy(This._mutex1)
Mutexdestroy(This._mutex2)
Mutexdestroy(This._mutex3)
End Destructor
If you had the time and the inclination to try both, I would be grateful.
-
- Posts: 4292
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: wth -- Thread time .vs Subroutine time
- Version "pre _mutex3" + correction "blocking": Failed 4MB
- Version "pre _mutex3" + correction "blocking" + change #2 (but not change #1): Failed 32MB
- Version "pre _mutex3" + correction "blocking" + change #2 (but not change #1): Failed 32MB
Re: wth -- Thread time .vs Subroutine time
All of this is incomprehensible !
Do you use a gcc optimization level ('-Ox') when compiling ?
Do you use a gcc optimization level ('-Ox') when compiling ?
-
- Posts: 4292
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: wth -- Thread time .vs Subroutine time
Yes, -O2, for all tests including the version which works.fxm wrote:Do you use a gcc optimization level ('-Ox') when compiling ?
I have just used gas and the last two versions failed with that.
Re: wth -- Thread time .vs Subroutine time
Well, all of this is not satisfactory.
Neither 'ThreadPooling' version satisfies us both.
So, for the moment I do not valid any 'ThreadPooling' version.
I only valid the 'ThreadInitThenMultiStart' version.
Neither 'ThreadPooling' version satisfies us both.
So, for the moment I do not valid any 'ThreadPooling' version.
I only valid the 'ThreadInitThenMultiStart' version.
-
- Posts: 4292
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: wth -- Thread time .vs Subroutine time
@fxm
Well, you certainly gave it a good try.
'ThreadInitThenMultiStart' is working with CryptoRndII to at least 1TB is readable and easy to use.
If it is any consolation if anyone else other than FreeBASIC users want to use thread pooling as CryptoRndII does then they will have to use Microsoft's method.
As I have indicated previously that is, in my opinion, a monumental achievement and should be part of the FreeBASIC package. Some PowerBASIC users would give their right arm to use a MultiStart method with their threading applications without the need to use Mirosoft's method; which is what I will do in future.
Well, you certainly gave it a good try.
'ThreadInitThenMultiStart' is working with CryptoRndII to at least 1TB is readable and easy to use.
If it is any consolation if anyone else other than FreeBASIC users want to use thread pooling as CryptoRndII does then they will have to use Microsoft's method.
As I have indicated previously that is, in my opinion, a monumental achievement and should be part of the FreeBASIC package. Some PowerBASIC users would give their right arm to use a MultiStart method with their threading applications without the need to use Mirosoft's method; which is what I will do in future.
-
- Posts: 534
- Joined: Dec 02, 2011 22:51
- Location: France
Re: wth -- Thread time .vs Subroutine time
When I posted that one viewtopic.php?f=17&t=29102#p279074 I could not imagine someone could be able to take me at my word. 'However, try to come up with a design(not technique, just 'coup de crayon') that is same time original, intuitive, and relevant'. I was wrong.
-
- Posts: 4292
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: wth -- Thread time .vs Subroutine time
... and we should thank our lucky stars that we have someone with fxm's calibre maintaining the Documentation Forum and Programmer's Guide.
Re: wth -- Thread time .vs Subroutine time
After thinking calmly, I believe I solved the 'ThreadPooling' Type problem.
It is indeed necessary to be able to do (for the 'PoolingSubmit', 'PoolingWait' and 'Destructeur' methods, all in competition with '_Thread') atomic mutex unlockings, which is not possible with simple mutexlocks / mutexunlocks.
This therefore requires the use of conditional variables (condwait / condsignal).
New version 'ThreadPooling' "super_new":
It is indeed necessary to be able to do (for the 'PoolingSubmit', 'PoolingWait' and 'Destructeur' methods, all in competition with '_Thread') atomic mutex unlockings, which is not possible with simple mutexlocks / mutexunlocks.
This therefore requires the use of conditional variables (condwait / condsignal).
New version 'ThreadPooling' "super_new":
Code: Select all
#include once "crt/string.bi"
Type ThreadPooling '' version super-new
Public:
Declare Constructor()
Declare Sub PoolingSubmit(Byval pThread As Function(Byval As Any Ptr) As String, Byval p As Any Ptr = 0)
Declare Sub PoolingWait()
Declare Sub PoolingWait(values() As String)
Declare Property PoolingState() As Ubyte
Declare Destructor()
Private:
Dim As Function(Byval p As Any Ptr) As String _pThread0
Dim As Any Ptr _p0
Dim As Function(Byval p As Any Ptr) As String _pThread(Any)
Dim As Any Ptr _p(Any)
Dim As Any Ptr _mutex
Dim As Any Ptr _cond1
Dim As Any Ptr _cond2
Dim As Any Ptr _pt
Dim As Byte _end
Dim As String _returnF(Any)
Dim As Ubyte _state
Declare Static Sub _Thread(Byval p As Any Ptr)
End Type
Constructor ThreadPooling()
Redim This._pThread(0)
Redim This._p(0)
Redim This._returnF(0)
This._mutex = Mutexcreate()
This._cond1 = Condcreate()
This._cond2 = Condcreate()
This._pt= Threadcreate(@ThreadPooling._Thread, @This)
End Constructor
Sub ThreadPooling.PoolingSubmit(Byval pThread As Function(Byval As Any Ptr) As String, Byval p As Any Ptr = 0)
Mutexlock(This._mutex)
Redim Preserve This._pThread(Ubound(This._pThread) + 1)
This._pThread(Ubound(This._pThread)) = pThread
Redim Preserve This._p(Ubound(This._p) + 1)
This._p(Ubound(This._p)) = p
CondSignal(This._cond2)
This._state = 1
Mutexunlock(This._mutex)
End Sub
Sub ThreadPooling.PoolingWait()
Mutexlock(This._mutex)
While (This._state And 11) > 0
Condwait(This._Cond1, This._mutex)
Wend
Redim This._returnF(0)
This._state = 0
Mutexunlock(This._mutex)
End Sub
Sub ThreadPooling.PoolingWait(values() As String)
Mutexlock(This._mutex)
While (This._state And 11) > 0
Condwait(This._Cond1, This._mutex)
Wend
If Ubound(This._returnF) > 0 Then
Redim values(1 To Ubound(This._returnF))
For I As Integer = 1 To Ubound(This._returnF)
values(I) = This._returnF(I)
Next I
Redim This._returnF(0)
Else
Erase values
End If
This._state = 0
Mutexunlock(This._mutex)
End Sub
Property ThreadPooling.PoolingState() As UByte
If UBound(This._p) > 0 Then
Return 8 + This._state
Else
Return This._state
End If
End Property
Sub ThreadPooling._Thread(Byval p As Any Ptr)
Dim As ThreadPooling Ptr pThis = p
Do
Mutexlock(pThis->_mutex)
If Ubound(pThis->_pThread) = 0 Then
pThis->_state = 4
CondSignal(pThis->_cond1)
While Ubound(pThis->_pThread) = 0
Condwait(pThis->_cond2, pThis->_mutex)
If pThis->_end = 1 Then Exit Sub
Wend
End If
pThis->_pThread0 = pThis->_pThread(1)
pThis->_p0 = pThis->_p(1)
If Ubound(pThis->_pThread) > 1 Then
memmove(@pThis->_pThread(1), @pThis->_pThread(2), (Ubound(pThis->_pThread) - 1) * Sizeof(pThis->_pThread))
memmove(@pThis->_p(1), @pThis->_p(2), (Ubound(pThis->_p) - 1) * Sizeof(pThis->_p))
End If
Redim Preserve pThis->_pThread(Ubound(pThis->_pThread) - 1)
Redim Preserve pThis->_p(Ubound(pThis->_p) - 1)
Mutexunlock(pThis->_mutex)
Redim Preserve pThis->_ReturnF(Ubound(pThis->_returnF) + 1)
pThis->_state = 2
pThis->_returnF(Ubound(pThis->_returnF)) = pThis->_pThread0(pThis->_p0)
Loop
End Sub
Destructor ThreadPooling()
Mutexlock(This._mutex)
This._end = 1
CondSignal(This._cond2)
Mutexunlock(This._mutex)
.ThreadWait(This._pt)
Mutexdestroy(This._mutex)
Conddestroy(This._cond1)
Conddestroy(This._cond2)
End Destructor
Last edited by fxm on Mar 04, 2023 9:35, edited 5 times in total.
Reason: Added state flag for 'ThreadPooling' and corrected case of blocking for 'ThreadPooling' and therefore also for 'ThreadDispatching' + optimization.
Reason: Added state flag for 'ThreadPooling' and corrected case of blocking for 'ThreadPooling' and therefore also for 'ThreadDispatching' + optimization.
-
- Posts: 4292
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: wth -- Thread time .vs Subroutine time
I have just gone past 64GB.
It is looking good, Houston.
It is looking good, Houston.
-
- Posts: 4292
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
-
- Posts: 4292
- Joined: Jan 02, 2017 0:34
- Location: UK
- Contact:
Re: wth -- Thread time .vs Subroutine time
Break out the champagne - 1TB and only a couple of small anomalies.
A superb result.
A superb result.
Code: Select all
Microsoft Windows [Version 10.0.19042.804]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\deltarho>E:
E:\>cd pr64
E:\PR64>My_RNG | rng_test stdin32 -tlmin 1KB -multithreaded
RNG_test using PractRand version 0.94
RNG = RNG_stdin32, seed = unknown
test set = core, folding = standard (32 bit)
rng=RNG_stdin32, seed=unknown
length= 1 kilobyte (2^10 bytes), time= 0.1 seconds
no anomalies in 6 test result(s)
rng=RNG_stdin32, seed=unknown
length= 2 kilobytes (2^11 bytes), time= 0.2 seconds
no anomalies in 8 test result(s)
rng=RNG_stdin32, seed=unknown
length= 4 kilobytes (2^12 bytes), time= 0.2 seconds
no anomalies in 18 test result(s)
rng=RNG_stdin32, seed=unknown
length= 8 kilobytes (2^13 bytes), time= 0.4 seconds
no anomalies in 21 test result(s)
rng=RNG_stdin32, seed=unknown
length= 16 kilobytes (2^14 bytes), time= 0.6 seconds
no anomalies in 26 test result(s)
rng=RNG_stdin32, seed=unknown
length= 32 kilobytes (2^15 bytes), time= 0.9 seconds
no anomalies in 34 test result(s)
rng=RNG_stdin32, seed=unknown
length= 64 kilobytes (2^16 bytes), time= 1.2 seconds
no anomalies in 42 test result(s)
rng=RNG_stdin32, seed=unknown
length= 128 kilobytes (2^17 bytes), time= 1.5 seconds
no anomalies in 50 test result(s)
rng=RNG_stdin32, seed=unknown
length= 256 kilobytes (2^18 bytes), time= 1.8 seconds
no anomalies in 59 test result(s)
rng=RNG_stdin32, seed=unknown
length= 512 kilobytes (2^19 bytes), time= 2.2 seconds
no anomalies in 67 test result(s)
rng=RNG_stdin32, seed=unknown
length= 1 megabyte (2^20 bytes), time= 2.5 seconds
no anomalies in 74 test result(s)
rng=RNG_stdin32, seed=unknown
length= 2 megabytes (2^21 bytes), time= 2.9 seconds
no anomalies in 87 test result(s)
rng=RNG_stdin32, seed=unknown
length= 4 megabytes (2^22 bytes), time= 3.2 seconds
no anomalies in 97 test result(s)
rng=RNG_stdin32, seed=unknown
length= 8 megabytes (2^23 bytes), time= 3.6 seconds
no anomalies in 106 test result(s)
rng=RNG_stdin32, seed=unknown
length= 16 megabytes (2^24 bytes), time= 4.0 seconds
no anomalies in 118 test result(s)
rng=RNG_stdin32, seed=unknown
length= 32 megabytes (2^25 bytes), time= 4.5 seconds
Test Name Raw Processed Evaluation
[Low8/32]DC6-9x1Bytes-1 R= +6.0 p = 4.5e-3 unusual
...and 127 test result(s) without anomalies
rng=RNG_stdin32, seed=unknown
length= 64 megabytes (2^26 bytes), time= 5.0 seconds
no anomalies in 140 test result(s)
rng=RNG_stdin32, seed=unknown
length= 128 megabytes (2^27 bytes), time= 5.7 seconds
no anomalies in 154 test result(s)
rng=RNG_stdin32, seed=unknown
length= 256 megabytes (2^28 bytes), time= 6.7 seconds
no anomalies in 165 test result(s)
rng=RNG_stdin32, seed=unknown
length= 512 megabytes (2^29 bytes), time= 8.1 seconds
no anomalies in 178 test result(s)
rng=RNG_stdin32, seed=unknown
length= 1 gigabyte (2^30 bytes), time= 10.6 seconds
Test Name Raw Processed Evaluation
[Low8/32]BCFN(2+1,13-2,T) R= +9.1 p = 3.0e-4 unusual
...and 191 test result(s) without anomalies
rng=RNG_stdin32, seed=unknown
length= 2 gigabytes (2^31 bytes), time= 15.2 seconds
no anomalies in 204 test result(s)
rng=RNG_stdin32, seed=unknown
length= 4 gigabytes (2^32 bytes), time= 23.9 seconds
no anomalies in 216 test result(s)
rng=RNG_stdin32, seed=unknown
length= 8 gigabytes (2^33 bytes), time= 42.1 seconds
no anomalies in 229 test result(s)
rng=RNG_stdin32, seed=unknown
length= 16 gigabytes (2^34 bytes), time= 78.0 seconds
no anomalies in 240 test result(s)
rng=RNG_stdin32, seed=unknown
length= 32 gigabytes (2^35 bytes), time= 147 seconds
no anomalies in 251 test result(s)
rng=RNG_stdin32, seed=unknown
length= 64 gigabytes (2^36 bytes), time= 294 seconds
no anomalies in 263 test result(s)
rng=RNG_stdin32, seed=unknown
length= 128 gigabytes (2^37 bytes), time= 577 seconds
no anomalies in 273 test result(s)
rng=RNG_stdin32, seed=unknown
length= 256 gigabytes (2^38 bytes), time= 1105 seconds
no anomalies in 284 test result(s)
rng=RNG_stdin32, seed=unknown
length= 512 gigabytes (2^39 bytes), time= 2262 seconds
no anomalies in 295 test result(s)
rng=RNG_stdin32, seed=unknown
length= 1 terabyte (2^40 bytes), time= 4522 seconds
no anomalies in 304 test result(s)
-
- Posts: 534
- Joined: Dec 02, 2011 22:51
- Location: France
Re: wth -- Thread time .vs Subroutine time
When several threads, possibly distributed over separate cores or processors, share the same mutexes, the additional management of an atomic transactional problem on the mutex is imposed at the low level. However, the structure of the multistart syntax could avoid this constraint, and it has already been observed that CondWait and CondSignal induce a delay compared to mutexes (moreover, it is possible to suppose that the transactional problem was not absolutely evacuated, it will more likely have changed the order of magnitude of occurrence). If the goal of ThreadPooling is to simplify the syntax for managing thread pools, then it might seem relevant to wrap around multiStart rather than start from the paradigm of a code inside, because it's not clear that this would be technically less relevant. If the objective of ThreadPooling is mainly technical (reducing the number of mutexes), then ThreadPooling is relevant versus MultiStart. Over-implementing a ThreadPooling syntax around MultiStart could have two advantages: offloading the low level of a 'free' atomic transactional problem (even if the speed suffers little, the load (processor) may not be the same) , and would also allow a naturally compatible syntax (hierarchichal). I speak a lot, but I help little, thank you for being indulgent.