Efficient Threadpool Engine version 2.0

82 views
Skip to first unread message

Amine Moulay Ramdane

unread,
May 20, 2015, 12:15:30 PM5/20/15
to lock...@googlegroups.com
Hello...


I have finally implemented an efficient Threadpool engine version 2.0, this version is really efficient because you can give priorities to your jobs that you will distribute to the Threadpool, and when you give for example a high priority for the jobs , the jobs of the high priority will be executed faster and the response time will be lower, also when you distribute your jobs in a thread and you wait for them, you will wait only for those jobs to finish , you will not wait for all the jobs inside the Threadpool engine to finish, and that's efficient, other than that my efficient Threadpool engine with priorities has given a throughput of 3.2 millions of transactions per second and that's great !

I have added 3 methods to my efficient Threadpool engine, now you can wait for the jobs to finish with the wait() method, please read the HTML tutorial inside the zip file to understand more how to use my efficient Threadpool engine...


You can download my efficient Threadpool Engine version 2.0 from:

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



And please click on the small arrow on the right of the zip file to download..


Thank you,
Amine Moulay Ramdane. 


Amine Moulay Ramdane

unread,
May 20, 2015, 4:45:42 PM5/20/15
to lock...@googlegroups.com
Hello,

We have to be smart please, please 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: 

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.0 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.

And as  you have noticed i have implemented an efficient Threadpool engine version 2.0, also what i want to say in this post, is that i have made it smart like a smart automaton with states and transitions that will guide you using exception handling so that to avoid the forbiden transitions. I have enhanced the automaton and i think that it's efficient now, 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 version 2.0 from:




Thank you,
Amine Moulay Ramdane.


Amine Moulay Ramdane

unread,
May 23, 2015, 12:33:53 PM5/23/15
to lock...@googlegroups.com

Hello, 


My efficient Threadpool engine was updated to version 2.01, i have analysed the automaton of my Threadpool engine and i have noticed that it was still allowing some forbidden transitions, so i have added more to the automaton so that it forbid all the forbidden transitions, and i think now that it is more efficient and reliable. So hope that you will be happy with the new version 2.01.

In this post i will talk about an important subject that is software "reliability", you have seen me on my previous posts 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.


You can download my new efficient Threadpool engine version 2.01 from:

Amine Moulay Ramdane

unread,
May 25, 2015, 11:40:36 AM5/25/15
to lock...@googlegroups.com

Hello,


My efficient Threadpool engine with priorities was updated to version 2.1, i have 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, and i have also changed the algorithm of my efficient Threadpool engine and now i have tested it thoroughly and i think that it's a stable and a correct algorithm and it's fast, i have also updated the HTML tutorial inside the zipfile, please look inside the tutorial to learn how to use my efficient Threadpool engine.

I have also updated my Threadpool engine to version 2.1..


You can download my efficient Threadpool engine with priorities version 2.1 from:

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


And you can download my Threadpool engine version 2.1 from:

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


Thank you,
Amine Moulay Ramdane.


Amine Moulay Ramdane

unread,
May 25, 2015, 4:19:01 PM5/25/15
to lock...@googlegroups.com

Hello,

You have to know that to design and implement an efficient Threadpool as my efficient Threadpool engine with priorities that i think is correct and efficient, it is somewhat a hard job, so to facilitate the reasonning about concurrent programming i have 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 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: 


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.1 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. 

You can download my efficient Threadpool engine from:
Reply all
Reply to author
Forward
0 new messages