Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create a Makefile for the following codes forkchildren1.c #include #include #include #include int main() { for(int i=0;i <5;i++) { if(fork() == 0) { for(int j=1;j

create a Makefile for the following codes

forkchildren1.c

#include #include #include #include int main() { for(int i=0;i<5;i++) { if(fork() == 0) { for(int j=1;j<=6;j++) { printf("I am child %d and this is my %d message ",getpid(),j); sleep(3); } exit(0); } else { pid_t cpid; cpid = wait(NULL); printf("Exited Child pid = %d ", cpid); } } }

forkchildren2.c

#include #include #include #include void main() { int n1 = fork(); int n2 = fork(); if (n1 == 0 && n2 > 0) //checking if child1 { system("ls -l"); exit(0); } else { pid_t cpid; cpid = wait(NULL); } if (n1 > 0 && n2 == 0) //checking if child2 { system("cat forkchildren.c"); exit(0); } else { pid_t cpid; cpid = wait(NULL); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

8 What can HRM do to manage diversity?

Answered: 1 week ago

Question

Describe the Indian constitution and political system.

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago

Question

3. Are our bosses always right? If not, what should we do?

Answered: 1 week ago