Process creation and termination - fork(), exec(), wait() and exit()
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()
thank you sharing your knowledge and nice teaching
Great explanation thank you, keep it up!!
Thank you so much for this video ❤
World class explanation. Many thanks for your knowledge. And your amazing teaching skills.
Much needed. Thanks
absolutely nailed it !! What a beautiful explaination crisp and to the point !!
Thank you :)
great explanation
Thank you Mr Shahid
mashaAllah such a nice explanation
Excellent explanation | Expert level
Thank you!!
thankyou🥺
Nice explanation!
Thank you!
Explanantion was so good
Amazing 😍❤
thanks❤
Your voice is very pretty
love from Pakistan
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 🤗😊
Thank you! Glad it helped :)
You are the best best bestt 💜💜💜💜
Nailed it
WooHooooo amazingggggggg!!!!!!
amazing video
Thank you!
Voice 🗿🗿🗿🗿
Please create tutorial for system programming in unix environment, Data science [ AI ML NN DL ] programming tutorials
Main be a voice actor man
i guess wait() needs an argument to work properly