Prev: Java to Ada
Next: A good methodology ...
From: aminer on 3 Apr 2010 22:47 Hello, I am still thinking and using logic... I can add the following rules also: [5] IF you are using a critical section or spinlock and there is a high contention- with many threads - on them THEN there is a possibility of a Lock convoy. Due to the fact that the thread entering the spinlock or critical section may context switch and this will add to the service time - and to the S (serial part) of the Amdahl's equation - and this will higher the contention and create a possibility of a Lock convoy and to a bad scalability. We can elevate the problem in [5] by using a Mutex or a Semaphore around the crital section or the spinlock... Another rule now.. [6] If there is contention on a lock - a critical section ... - and inside the locked sections you are the I/O - example loging a message to a file - this will lead the calling thread block on the I/O and the operating system will deschedule the blocked thread until the I/O completes, thus this situation will lead to more context switching, and therefore to an increased service time , and longer service times, in this case, means more lock contention, and more lock contention means a bad scalability. there is also false sharing etc. IF you follow and base your reasonning on those theorems - or laws or true propositions or good patterns - like rules or theorems [1] , [2] , [3], [4] , [5], [6]... - THEN your will construct a model that will be much more CORRECT and EFFICIENT. And it is one of my preferred methodology in programming. I will try to add more of those rules , theorems , laws... in next time... Sincerely, Amine Moulay Ramdane.
From: aminer on 4 Apr 2010 02:28
Skybuck wrote: >Some notes/pointers: >1. The adventage of "blocking locks" on windows is that it doesn't consume >so much cpu (?) when it's waiting... this leads to lower cpu temperatures. >2. Nowadays I want to make my programs run as "cold" as possible to save the >system from overheat death. >3. Spinlocks make the cpu run hot and there is bad ?! Unless very maybe the >blocking scenerio would be worse, but that needs to be proven first. Read carefully: "The worker threads enters in a wait state when there is no job in the lock-free queues - for more efficiency -" http://pages.videotron.com/aminer/threadpool.htm So, my Thread Pool Engine doesn't consume any CPU when there is no job in the queues , and this leads to lower cpu temperatures. :) Sincerely, Amine Moulay Ramdane. |