#include #include #include #include #include int main(int ac, char *av[]) { int64_t amount = atoll(av[1]); int children = atoi(av[2]); while (--children) if (fork()) break; signal(SIGALRM, _exit); alarm(180); printf("Process %d allocating %ld bytes\n", getpid(), amount); char * buffer = malloc(amount); if (buffer == NULL) { perror("malloc"); exit(-1); } size_t i, pgsize = getpagesize(); for (;;) { printf("Process %d touching %ld bytes\n", getpid(), amount); for (i = 0; i < amount; i += pgsize) { buffer[i] = 0; } } sleep(100); return 0; }