How to create child process using fork() || Duplicate Process

How to create child process using fork() || Duplicate Process

DexTutor

4 года назад

62,687 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@rampujansharma3440
@rampujansharma3440 - 14.08.2022 20:27

i am very grateful to you,,...this is the first time i am posting any comment ...i love you sir ....its really helpful ..i appreciate your service ..god bless you .

Ответить
@aishwaryasingla2781
@aishwaryasingla2781 - 11.10.2023 18:56

Sir in my output in parent block parent id is always printing 1. why is that ? and my outputs are also fixed like first child block is printing and then parent block they are not getting mixed like in yours. Does it have to do something with fact that i am working in zsh bash?

Ответить
@Sruthimugle
@Sruthimugle - 03.05.2023 12:28

sir i have implemented the same code but its showing error near else

Ответить
@ss8273
@ss8273 - 09.03.2023 10:34

👍👍👍

Ответить
@jananisrisudhakar8261
@jananisrisudhakar8261 - 07.03.2023 16:40

plz use English throughout the video.I don't understand hindi

Ответить
@siddhantmaharana3936
@siddhantmaharana3936 - 01.03.2023 17:53

You said q is the pid of the child and fork() returns the value of pid of child. However you said if q==0 is true then it is the child process. Then how is q printed to be 93? Shouldnt it be printing 0?

Ответить
@prathyusha3993
@prathyusha3993 - 06.02.2023 18:13

the code for the exercise:
if(q==0)
fork();
only this part should be added,is this correct sir??

Ответить
@ashutoshranjan4644
@ashutoshranjan4644 - 09.12.2022 15:32

Does execution always prefer parent process first?

Ответить
@believer29
@believer29 - 22.11.2022 20:49

You're a lifesaver sir ! Great explanation

Ответить
@twishanuaichroy1938
@twishanuaichroy1938 - 31.08.2022 15:48

Thanks a lot Sir

Ответить
@anandchaudhari1483
@anandchaudhari1483 - 26.08.2022 14:09

i am getting different id at some time and same id at some time. for same program like
before fork
PARENT My child's id is 3025
PARENT I am parent having id 3024
Common
CHILD I am child having id 3025
CHILD My parent's id is 1461
Common

PLEASE EXPLAIN

Ответить
@rampujansharma3440
@rampujansharma3440 - 14.08.2022 20:47

int main()
{
pid_t p1,p2;
printf("Before Creating Child \n");
p1=fork();
if (p1==0)
{ printf("this is child process p1 having pid %d \n",getpid());
printf("parent id of child process p1 is p=%d \n",getppid());
p2=fork();
if (p2==0)
{ printf("this is child process p2 having pid %d \n",getpid());
printf("parent id pp1 of child process p2 is p=%d \n",getppid());
}
else {
printf("this is parent process pp1 having pid %d \n",getpid());
printf("pid of child process p2 is %d \n",p2);
}
}
else {
printf("this is parent process p having pid %d \n",getpid());
printf("pid of child process p1 is %d \n",p1);
}
}

Ответить
@rampujansharma3440
@rampujansharma3440 - 14.08.2022 20:47

This is code to create child process inside child process

Ответить
@745_riyasaha8
@745_riyasaha8 - 27.02.2022 19:51

sir can u please share the last que's solution its bit confusing and can u please explain with 2 3 examples .....that will be very helpful

Ответить
@kinshipstatus4027
@kinshipstatus4027 - 04.02.2022 07:48

such a great tutor , love you sir

Ответить
@priyeshchaturvedi503
@priyeshchaturvedi503 - 01.11.2021 13:47

please explain ls and ps command using c in system calls

Ответить
@nilanjanmajumder8508
@nilanjanmajumder8508 - 16.08.2021 20:58

great explanation

Ответить
@chandanmandal5394
@chandanmandal5394 - 01.02.2021 03:21

kumar

Ответить
@amitgupta2890
@amitgupta2890 - 16.12.2020 06:27

good explanation sir
loved it.

Ответить
@saikun0293
@saikun0293 - 30.10.2020 14:18

Super!

Ответить
@Preeti606_7
@Preeti606_7 - 30.09.2020 19:31

Where are more videos???? Only 11 videos i could find....plz upload more!

Ответить
@NaveenKumar-cf9di
@NaveenKumar-cf9di - 19.05.2020 07:35

bahut wadia explain kita..simple te practical approach

Ответить