Question: Please complete both tasks for a thumbs up :-) #include #include int main (void) { printf(I am process %ld , (long) getpid()); printf(My parent is
Please complete both tasks for a thumbs up :-)

#include#include int main (void) { printf("I am process %ld ", (long) getpid()); printf("My parent is %ld ", (long)getppid()); printf("Process user id is %ld ", (long)getuid()); printf("Group id is %ld ", (long)getgid()); return 0; }

#include#include"stdio.h" #include int globalVariable = 2; int main() { char parentStr[] = "Parent Process"; char childStr[] = "Child Process"; char *string = NULL; int functionVariable = 20; // Create a child process. pid_t pid = ______; if (______) // Failed to fork { perror("Unable to create child process"); return 1; } else if (______) // child { // Code only executed by child process string = &childStr[0]; globalVariable++; functionVariable++; } ______ // parent { // Code only executed by parent process string = &parentStr[0]; globalVariable += 2; functionVariable += 2; } // Code executed by both parent and child. printf("%s ", string); printf(" Global Variable: %d ",globalVariable); printf(" Function Variable: %d ", functionVariable); }
Task 1' (20 points) Here is a C program that prints out the process id, the parent process id, the process user id, and group id. Please type it in your computer and save as taskl.c. Now compile it and run it to see how it works Include your screenshots in your submission
Step by Step Solution
There are 3 Steps involved in it
To complete Task 1 and Task 2 Ill guide you step by step Task 1 Create the C Program The provided co... View full answer
Get step-by-step solutions from verified subject matter experts
