Process creation and termination - fork(), exec(), wait() and exit()

Sdílet
Vložit
  • čas přidán 10. 02. 2023
  • Process creation is done in UNIX system with the help of the fork() command. The process which creates another process is called the 'parent' process and the process which gets created is the 'child' process.
    - fork() creates a duplicate child process same as parent - the program and data is copied to child process and both these would run concurrently.
    - exec() is used to overlay a block of code with a new block of code - this way the parent and child can run 2 different programs at the same time
    - wait() is called by parent and this suspends parent process and it waits till child completes
    - exit() is called to properly terminate the process by deallocating the resources which were allocated for the process.
    If parent does not call wait(), then it would continue running without waiting for the child. If child terminates by calling exit(), then since parent does not wait for this, there is no one to catch its exit status. The child process has terminated, but its entry in process table exists. Removal of this entry is done by the parent process, but since parent doesn't wait(), it doesnt receive the exit status of child and hence doesnt remove the child process entry from the table. Such processes are called ZOMBIE processes.
    If parent does not call wait(), but terminates by calling exit(), then parent is no more and if child is still running then such child process becomes an ORPHAN process.
    #fork()
    #exec()
    #wait()

Komentáře • 31

  • @Ganesh-zj1qp
    @Ganesh-zj1qp Před 14 dny +1

    thank you sharing your knowledge and nice teaching

  • @younesscoder
    @younesscoder Před 12 dny +1

    Great explanation thank you, keep it up!!

  • @thirteenth137
    @thirteenth137 Před 8 měsíci +1

    Thank you so much for this video ❤

  • @LoperamideTV
    @LoperamideTV Před 3 měsíci +1

    World class explanation. Many thanks for your knowledge. And your amazing teaching skills.

  • @StayBig
    @StayBig Před 7 měsíci +1

    Much needed. Thanks

  • @futurementor1856
    @futurementor1856 Před 4 měsíci +1

    absolutely nailed it !! What a beautiful explaination crisp and to the point !!

  • @39_ganesh_ghodke98
    @39_ganesh_ghodke98 Před 8 měsíci +1

    great explanation

  • @Faithie123
    @Faithie123 Před 4 měsíci +1

    Thank you Mr Shahid

  • @saqibullah7286
    @saqibullah7286 Před 3 měsíci +2

    mashaAllah such a nice explanation

  • @stream.abhimanyu
    @stream.abhimanyu Před 7 měsíci +4

    Excellent explanation | Expert level

  • @Safna-123
    @Safna-123 Před 27 dny +1

    thankyou🥺

  • @dishasharma7065
    @dishasharma7065 Před rokem +1

    Nice explanation!

  • @vishalparida264
    @vishalparida264 Před 6 měsíci +1

    Explanantion was so good

  • @amnashahzadi7608
    @amnashahzadi7608 Před 8 měsíci +1

    Amazing 😍❤

  • @acesnipergaming7487
    @acesnipergaming7487 Před 6 měsíci +1

    thanks❤

  • @zero-ui1ew
    @zero-ui1ew Před 10 dny +1

    Your voice is very pretty

  • @user-uo7th2ms7e
    @user-uo7th2ms7e Před 9 měsíci +1

    love from Pakistan

  • @aleeha67
    @aleeha67 Před 3 měsíci

    Sir i watch alot od videos out there on this Topic, But the way you teach is very affective. Thankyou So much. May God Bless You and your channel hits the 1 million Subscribers one day 🤗😊

  • @aleeha67
    @aleeha67 Před 3 měsíci +1

    You are the best best bestt 💜💜💜💜

  • @user-zb4bb7jo9q
    @user-zb4bb7jo9q Před 4 měsíci +1

    Nailed it

  • @rishi2820
    @rishi2820 Před 3 měsíci +1

    WooHooooo amazingggggggg!!!!!!

  • @zehrad5255
    @zehrad5255 Před rokem +1

    amazing video

  • @famer_22
    @famer_22 Před 4 měsíci +12

    Voice 🗿🗿🗿🗿

  • @stream.abhimanyu
    @stream.abhimanyu Před 7 měsíci

    Please create tutorial for system programming in unix environment, Data science [ AI ML NN DL ] programming tutorials

  • @MonkeyDluffy_111
    @MonkeyDluffy_111 Před 3 měsíci +1

    Main be a voice actor man

  • @electrowizard2658
    @electrowizard2658 Před 2 měsíci

    i guess wait() needs an argument to work properly