/* Time to wait for workers to get preempted (seconds) */ #define PREEMPT_TIME 20 /* *FactorbywhichtomultiplynumberofonlineCPUsfortotalnumberof *workerthreads
*/ #define THREAD_FACTOR 8
running = true;
threads_starting = threads; for (i = 0; i < threads; i++) {
rc = pthread_create(&tids[i], NULL, preempt_vmx_c, NULL);
FAIL_IF(rc);
}
setbuf(stdout, NULL); /* Not really nessesary but nice to wait for every thread to start */
printf("\tWaiting for all workers to start..."); while(threads_starting) asmvolatile("": : :"memory");
printf("done\n");
printf("\tWaiting for %d seconds to let some workers get preempted...", PREEMPT_TIME);
sleep(PREEMPT_TIME);
printf("done\n");
printf("\tStopping workers..."); /* *Workingarecheckingthisvalueeveryloop.Inpreempt_vmx'cmpwir5,0;bne2b'. *r5willhaveloadedthevalueofrunning.
*/
running = 0; for (i = 0; i < threads; i++) { void *rc_p;
pthread_join(tids[i], &rc_p);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.