memory benchmark + app exit code test + thread scheduler observations.

This commit is contained in:
Vahagn Khachatryan
2013-09-19 18:34:43 +04:00
parent d45f136252
commit 13281ad9b9
4 changed files with 680 additions and 5 deletions

View File

@@ -5,12 +5,17 @@ VIM: let g:cf5output=0
/*
* Conclusion:
* Linux RH 5.7 scheduler affiliates threads to a core. As a result
* Linux RH 5.7 scheduler affiliates threads to a core perhaps. As a result
* if 20 threads are working on 16 core machine then 12 of them work
* 100% of the time and the 8 are working only 50% of the time.
* 34 thread case also was tested and the result is 28 threads work 50%
* of the time and 6 threads work 33% of the time.
* This same effect is visible in Intel TBB.
* Looks RH 5.7 uses linux kernel 2.6.18 which has O(1) scheduler.
*
* Linux RH 6.0 has linux kernel 2.6.32 which has Ingo Molnár's the
* "Completely Fair Scheduler". On that system the above mentioned is not
* observed.
*/
#include <thread>
@@ -33,11 +38,11 @@ void busy_wait()
int main ( void )
{try{
const int n = 20;
const int n = 34;
std::atomic<int> last_id(0);
typedef long long work_type;
const work_type wamount = 1024L*1024L*10;
const work_type wamount = 1024L*1024L*40;
const work_type wslot = 1;
std::atomic<work_type> last_work(0);