CS计算机代考程序代写 #include

#include
#include
#include
#include
#include
#include

int main(int argc, char* argv[]) {

int pid;
printf(“I am the parent %d. My priority is %d\n”,
getpid(),getpriority(PRIO_PROCESS,getpid()));

if ((pid = fork())==0){
printf(“I am the child %d. My priority is %d\n”,
getpid(),getpriority(PRIO_PROCESS,getpid()));
setpriority(PRIO_PROCESS,getpid(),19);
printf(“I am the child %d. My priority is now %d\n”,
getpid(),getpriority(PRIO_PROCESS,getpid()));
exit(20);
}
else{
sleep(5);
printf(“Changing parent’s priority…\n”);
printf(“Parent: nice(10) returns %d\n”,nice(10));

int status;
int term_pid = wait(&status);
}
}