Created
October 16, 2012 18:54
-
-
Save farhaven/3901216 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <fcntl.h> | |
#include <sys/types.h> | |
#include <unistd.h> | |
#define CHILDREN 50 | |
void | |
spin(void) { | |
while (1) { | |
int fh = open("/dev/kmem", O_RDWR, 0); | |
if (fh >= 0) | |
close(fh); | |
} | |
} | |
int | |
main(void) { | |
uint32_t i; | |
for (i = 0; i < CHILDREN; i++) { | |
pid_t p = fork(); | |
if (p == 0) /* child */ | |
spin(); | |
} | |
spin(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment