Zxian Posted December 19, 2005 Share Posted December 19, 2005 For those of you who might be wondering about the test program, I e-mailed my prof and he sent me the source code:#include <sys/types.h>#include <sys/time.h>#include <unistd.h>#include <stdlib.h>#include <stdio.h>int main(int argc, char **argv){ int i; time_t startTime = time(0), now; for (i = 0; i < 9; ++i) { if (!fork()) break; } i = 0; while (1) { ++i; now = time(0); if (now - startTime > 60) break; } printf("%d counted to %d\n", getpid(), i); fflush(stdout); return 0;}As you can see, it's really simple, but an effective test for proper processor schduling. It should complile in any Unix/Linux style OS, and in Windows, he compiled it under Cygwin. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now