Skip to content

Instantly share code, notes, and snippets.

@icco
Created March 2, 2009 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icco/72548 to your computer and use it in GitHub Desktop.
Save icco/72548 to your computer and use it in GitHub Desktop.
#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