









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Use of fork is explained in this ppt
Typology: Lecture notes
1 / 16
This page cannot be seen from the preview
Don't miss anything!
Memory Layout (^) Text Section – executable code (^) Data Section – global variables (^) Stack – function parameters, return addresses and local variables. (^) Heap – dynamically allocated during runtime (^) Current Activity
Principal events that cause process creation
main() { pid_t pid; pid = fork(); if (pid == 0) printf("\nI am the child %d\n",pid); else printf("\nI am the parent %d\n",pid); }
int main(void) { int i; int status; pid_t pid; if(fork()) { pid = wait(&status); } else { execlp("date","date",0); } return 0; }