この c/c++ コードを使用して、2 つの異なるプログラムを並行して実行するように 2 つのプロセッサをスケジュールしました。2 つのプロセッサが 2 つのプログラムを並行して実行していることを確認する方法を教えてください。
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <iostream>
#include <sched.h>
#include <stdio.h>
#include <cstdlib>
int main(int argc, char *argv[])
{
cpu_set_t mask;
CPU_ZERO(&mask);
int pid;
pid=fork();
if (pid == 0) { /* second child */
CPU_SET(0, &mask);
sched_setaffinity(0, sizeof(mask), &mask);
system("/home/ifeanyi/Process/PID/Debug/PID");
}
else if (pid > 0) { // Parent ends
CPU_SET(1, &mask);
sched_setaffinity(getpid(), sizeof(mask), &mask);
cout << getpid() << endl;
system("/home/ifeanyi/Process/checkpointing/Debug/checkpointing"); // Last leaf
}
cout << endl;
}