[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.programming.threads

A new algorithm of my efficient Threadpool engine version 2.2

Ramine

5/27/2015 9:57:00 PM

Hello,


I have updated my efficient Threadpool engine with priorities
and my Threadpool engine to version 2.2, 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 have been reduced by 2 times, hope that you will
be happy with this new efficient algorithm... 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#meth...

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.2
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 with a boolean as a parameter and using also
wait() method that waits for the jobs to finish (this look like a
join()) with two 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.


You can download my efficient Threadpool engine with priorities from:


https://sites.google.com/site/aminer68/...-with-...


And you can download my Threadpool engine from:

https://sites.google.com/site/aminer68/...



Thank you,
Amine Moulay Ramdane.



1 Answer

Ramine

5/28/2015 8:52:00 PM

0


Hello,


My efficient Threadpool engine with priorities and my Threadpool engine
were updated to version 2.21.


You can download them from:

https://sites.google.com/site/aminer68/threadpool-with-...


Thank you,
Amine Moulay Ramdane.