これが私のプログラムです:
int main(int argc, char * argv[])
{
pid_t child;
int i=0;
if( argc < 4 ){
printf("Usage: %s <num_threads> <test_interval> <no_of_prints>\n", argv[0]);
exit(1);
}
// Some program logic goes here
printf("context - switch \n\nPid\ttid\tNPid\tNtid\tJiffies\n\n");
syscall(320);
child = fork();
if(child == 0 ) { //in child
fork();
fork();
process();
}
else {
wait(child);
//Do some printing here
}
私の出力には、「コンテキストスイッチ」printf
行が3つ(場合によっては2つ)印刷されています。