Created
March 2, 2009 00:31
-
-
Save icco/72548 to your computer and use it in GitHub Desktop.
This file contains 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 <stdio.h> | |
#include <linux/unistd.h> /* Defines _syscall0 and has mygetpid syscall number */ | |
#include <errno.h> /* need this for syscall0 macro too */ | |
_syscall0(long, quad) | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
#ifndef QNUM | |
#define QNUM 0 | |
#endif | |
int main() | |
{ | |
int i = 0; | |
int j = 0; | |
pid_t pid; | |
int s; | |
//printf("Time Slice: %d\n",(int)quad()); | |
for(i = 0; i < QNUM; i++) | |
quad(); | |
for(i = 0; i < 15; i++) | |
{ | |
pid = fork(); | |
} | |
if(pid > 0) | |
{ | |
waitpid(pid, &s, 0); | |
} | |
else | |
{ | |
for(j = 0; j < 100000; j++); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment