Monday, November 16, 2015

Digest for comp.programming.threads@googlegroups.com - 8 updates in 5 topics

Ramine <ramine@1.1>: Nov 15 06:52PM -0800

I correct, please reread
 
Hello,
 
 
 
I feel that i must explain to you how do work my inventions that are my
SemaCondvar and SemaMonitor objects, you will find those classes inside
the SemaCondvar.pas file inside the zip file, SemaCondvar and
SemaMonitor are new and portable synchronization objects , SemaCondvar
combines all the charateristics of a semaphore and a condition variable
and SemaMonitor combines all charateristics of a semaphore and an
eventcount , they only use an event object and a very fast and efficient
and portable FIFO fair Lock , so they are fast and they are FIFO fair.
 
When you set the first parameter of the constructor to true it will add
the characteristic of a Semaphore to the condition variable or to the
Eventcount, so the signal will not be lost if the threads are not
waiting for the SemaCondvar or SemaMonitor objects, but when you set the
first parameter of the constructor to false it will not behave like a
Semaphore because if the threads are not waiting for the SemaCondvar or
SemaMonitor the signal will be lost..
 
Now you can pass the SemaCondvar's or Semamonitor's initialcount and
SemaCondvar's or SemaMonitor's MaximumCount to the construtor, it's like
the windows Semaphore`s InitialCount and the Semaphore's MaximumCount.
 
Like this:
 
t:=TSemaMonitor.create(true,0,4);
You have 5 options in the defines.inc file for setting the kind of
locks, just look inside defines.inc , if you want to set it for the
Mutex that is energy efficient because it blocks the threads, uncomment
the option Mutex, if you want to set it for my node based scalable Lock,
uncomment the option MLock, if you want to set it for my scalable array
based lock called AMLock just uncomment the option AMLock inside
defines.inc, if you want to set it for Ticket Spinlock just uncomment
the option TicketSpinlock ,If you want to set it for Spinlock just
uncomment the option Spinlock.
That's all.
 
You can download my SemaMonitor and SemaCondvar from:
 
https://sites.google.com/site/aminer68/light-weight-semacondvar-semamonitor
 
and from:
 
https://sites.google.com/site/aminer68/semacondvar-semamonitor
 
Thank you,
Amine Moulay Ramdane.
bleachbot <bleachbot@httrack.com>: Nov 15 07:34PM +0100

bleachbot <bleachbot@httrack.com>: Nov 15 11:33PM +0100

bleachbot <bleachbot@httrack.com>: Nov 16 12:28AM +0100

bleachbot <bleachbot@httrack.com>: Nov 16 12:51AM +0100

Ramine <ramine@1.1>: Nov 15 06:29PM -0800

Hello,
 
 
I feel that i must explain to you how do work my inventions
that are my SemaCondvar and SemaMonitor objects, you will
find those classes inside the SemaCondvar.pas file inside
the zip file, SemaCondvar and SemaMonitor are new and portable
synchronization objects , SemaCondvar combines all the charateristics of
a semaphore and a condition variable and SemaMonitor combines all
charateristics of a semaphore and an eventcount , they only use an event
object and a very fast and efficient and portable FIFO fair Lock , so
they are fast and they are FIFO fair.
 
When you set the first parameter of the construction to true
it will add the characteristic of a Semaphore to the condition
variable or to the Eventcount, so the signal will not be lost
if the threads are not waiting for the SemaCondvar or SemaMonitor
objects, but when you set the forst parameter of the construtor
to false it will not behave like a Semaphore because if the threads are
not waiting for the SemaCondvar or SemaMonitor the signal will be lost..
 
Now you can pass the SemaCondvar's or Semamonitor's initialcount and
SemaCondvar's or SemaMonitor's MaximumCount to the construtor, it's like
the windows Semaphore`s InitialCount and the Semaphore's MaximumCount.
 
Like this:
 
t:=TSemaMonitor.create(true,0,4);
 
 
You have 5 options in the defines.inc file for setting the kind of
locks, just look inside defines.inc , if you want to set it for the
Mutex that is energy efficient because it blocks the threads,
uncomment the option Mutex, if you want to set it for my node based
scalable Lock, uncomment the option MLock, if you want to set it for my
scalable array based lock called AMLock just uncomment the option AMLock
inside defines.inc, if you want to set it for Ticket Spinlock just
uncomment the option TicketSpinlock ,If you want to set it for Spinlock
just uncomment the option Spinlock.
 
 
That's all.
 
You can download my SemaMonitor and SemaCondvar from:
 
https://sites.google.com/site/aminer68/light-weight-semacondvar-semamonitor
 
and from:
 
https://sites.google.com/site/aminer68/semacondvar-semamonitor
 
 
 
Thank you,
Amine Moulay Ramdane.
Ramine <ramine@1.1>: Nov 15 05:33PM -0800

Hello,
 
 
I have updated my following projects:
 
1- My SemaCondvar and SemaMonitor was updated to version 1.2
 
2- My scalable distributed reader-writer mutex was updated to
version 1.4
 
3- and my scalable RWLock was updated to version 3.4
 
 
What have changed on those projects is this:
 
My SemaCondvar and SemaMonitor was enhanced and it now fully compatible
support 64 bit.
 
And i have also changed the TQueue object of the Delphi and FreePascal
compilers that was slow with a FIFO queue that is more faster.
 
You can download my updated projects from the following links:
 
https://sites.google.com/site/aminer68/light-weight-semacondvar-semamonitor
 
https://sites.google.com/site/aminer68/semacondvar-semamonitor
 
https://sites.google.com/site/aminer68/scalable-distributed-reader-writer-mutex
 
https://sites.google.com/site/aminer68/scalable-rwlock
 
 
Hope you will enjoy all my projects now, because i have
stressed tested all of them a lot, and i think they are stable and
fast now. So enjoy all of them !
 
 
You can download all my projects from the following link:
 
https://sites.google.com/site/aminer68/
 
 
 
Thank you,
Amine Moulay Ramdane.
 
 
 
 
 
 
 
-
Ramine <ramine@1.1>: Nov 15 01:35PM -0800

Hello,
 
 
I have updated my Efficient Threadpool engine with priorities and
my Efficient Threadpool to version 2.3, now the concurrent FIFO queue
is more efficient under high contention.
 
You can download them from:
 
https://sites.google.com/site/aminer68/threadpool-with-priorities
 
and from:
 
https://sites.google.com/site/aminer68/threadpool
 
 
 
Description:
 
Efficient Thread Pool Engine.
 
The following have been added:
 
- You can give the following priorities to jobs:
 
LOW_PRIORITY
NORMAL_PRIORITY
HIGH_PRIORITY
 
- Uses a fast concurrent FIFO queue that satisfies many requirements: it
is FIFO fair, it minimizes efficiently the cache-coherence traffic and
it is energy efficient on the pop(): when there is no items in the queue
it will not spin-wait , but it will wait on a portable manual event object..
 
- Enters in a wait state when there is no job in the queue - for more
efficiency -
 
- You can distribute your jobs to the workers threads and call any
method with the threadpool's execute() method.
 
- You can wait for the jobs to finish with the wait() method.
 
- Uses O(1) complexity on enqueue and O(3) worst case complexity on dequeue.
 
I have updated my efficient Threadpool engine with priorities
and my Threadpool engine to version 2.3, i have come up with
a new algorithm that is more optimized, in this new algorithm i have
reduced and minimized the cache-line transfers so that the serial part
of the Amdahl law has been reduced by 2 times, hope that you will be
happy with this new efficient algorithm... i have also changed the
concurrent FIFO queue of my efficient Threadpool engine with priorities,
now the concurrent FIFO queue is waitfree on the push() and lockfree on
the pop(), so it's really fast, so as you have noticed that designing
and implementing an efficient Threadpool engine as my efficient
Threadpool engine with priorities is somewhat a hard job, so to
facilitate the reasonning about concurrent programming i have also used
my scalable AMLock around a small portion of the
TPThreadPoolThread.Execute() method of my efficient Threadpool engine
with priorities to facilitate the reasonning about "correctness", and i
think that now that my new algorithm has facilitated the reasonning
about correctness and now that i have tested it thoroughly , you can be
more confident cause i think that my new algorithm of my efficient
Threadpool engine with priorities is correct and stable now and it is
also very fast.
 
And look at the ThreadPoolExecutor Class of Java, look for example at
the awaitTermination() method, it says:
 
---
boolean awaitTermination(long timeout, TimeUnit unit)
 
Blocks until all tasks have completed execution after a shutdown
request, or the timeout occurs, or the current thread is interrupted,
whichever happens first.
--
 
read more here:
 
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadPoolExecutor.html#method.summary
 
Did you notice ?
 
In Java when you wait for the tasks you have to wait for "ALL" the
tasks, and that's not efficient , and if you want to use the object from
multiple threads i think it will have the same effect, you can avoid
some of the problems by using many objects of the ThreadPoolExecutor
class but this will take ressources and this will cause more and more
context switches and that's bad, i think C# has the same problem, other
than that Java and C# don't support priorities, it means that you can
not give priorities to tasks/jobs, like high or normal or low, and
that's not good for games and other applications where you have to use
priorities even if the system is not a realtime system, this is why i
have decided to implement my efficient Threadpool engine version 2.3
that supports those characteristics, so that you can create a child
object of the Threadpool class that will use the same worker threads and
that will wait only for the tasks that you will add with the execute()
method , and also my efficient Threadpool engine supports 3 priorities,
High and normal and low, that's where my efficient Threadpool engine
comes in hand and that's where it's efficient. Hope you will like it.
 
I will talk about an important subject that is software "reliability",
you have seen me explaining to you what is that it's efficient and
reliable with my efficient Threadpool engine, and you have seen me
talking to you about the automaton of my efficient Threadpool engine ,
this automaton takes care of software "reliability", like in design by
contracts that takes care of realiability, i have finally been able to
render my efficient Threadpool engine a reliable software by using an
automaton that "guides" you by helping you to avoid forbidden
transitions that can cause problems like deadlocks and dangerous
problems, my automaton has made my efficient threadpool engine a
reliable software, i explain more: since i am using 3 methods called
execute() that distributes the jobs to the worker threads and i am using
also setCounter() method and using also wait() method that waits for the
jobs to finish (this look like a join()) with one parameters, but what i
have noticed is that you can call those methods by combining them in a
different ways , but this can cause some combinations that are forbidden
to be called and that can cause deadlock or dangerous problems, this is
why i have wrote an automaton that help you and guide you by using also
exception handling to use the right combinations of those methods and
there parameters, so like in design by contracts, my automaton has made
my efficient Threadpool engine a reliable software. Please read the HTML
tutorial inside the zip file to understand how to use the execute() and
setCounter() and wait() methods etc.
 
Look into defines.inc there is many options:
 
CPU32: for 32 bits architecture
CPU64: for 64 bits architecture
 
Please read the HTML tutorial inside the zip.
 
Look at test.pas demo inside the zip file...
 
 
 
You can download them from:
 
https://sites.google.com/site/aminer68/threadpool-with-priorities
 
and from:
 
https://sites.google.com/site/aminer68/threadpool
 
 
 
Language: FPC Pascal v2.2.0+ / Delphi 5+: http://www.freepascal.org/
 
Operating Systems: Win , Linux and Mac (x86).
 
Required FPC switches: -O3 -Sd -dFPC -dWin32 -dFreePascal
 
-Sd for delphi mode....
 
Required Delphi switches: -DDelphi -DMSWINDOWS -$H+
 
For Delphi XE-XE7 use the -DXE switch
 
{$DEFINE CPU32} and {$DEFINE Windows32} for 32 bit systems
 
{$DEFINE CPU64} and {$DEFINE Windows64} for 64 bit systems
 
Note: testpool.pas is a parallel program of a Matrix multiply by a
vector that uses SSE+ and it requires Delphi 5+. test.pas and
test_thread.pas works with both FreePascal and Delphi.
 
 
 
Thank you,
Amine Moulay Ramdane.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.programming.threads+unsubscribe@googlegroups.com.

No comments: