吃CPU的openmp 程序
g++ -o eat -fopenmp eat.cpp #include "stdio.h" int main(int argc, char *argv[]) { #pragma omp parallel { while(1) { int c = 0; for(int i=0; i<(1<<30); ++i) { c += c*i; } } printf("hello multicore user!\n"); } return(0); }
然后CPU占用接近100%了。