Question: 3. (10 points) For the program below, assume the parent process has process ID (PID) 4810, and the child process has PID 5730. If the

3. (10 points) For the program below, assume the parent process has process ID (PID) 4810, and the child process has PID 5730. If the getpid() function returns the PID of the currently executing process, what will the program print?

int main() { pid_t pid, pid1; pid = fork(); if (pid == 0) { pid1 = getpid(); printf("child: pid = %d ", pid); printf("child: pid1 = %d ", pid1); } else if (pid > 0) { // Parent process pid1 = getpid(); printf("parent: pid = %d ", pid); printf("parent: pid1 = %d ", pid1); wait(NULL); } return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!