SlideShare a Scribd company logo
1 of 1
/* Hackintoshrao:codes for GNU/LINUX
   ILLUSTRATION OF ORPHAN PROCESS AND ASSIGNMENT OF INIT AS A PARENT TO SUCH A
PROCESS
   SYSTEM CALLS USED
   1.fork()
   2.getpid()
   3.getppid()
   4.sleep()
   */
#include<stdlib.h>
#include<unistd.h>
#include<time.h>
int main()
{
    int pid;
    pid=fork();
    if(pid==0)
    {


        printf("nChild process here n");
        printf("nchild here..Parent id=%d,Process id=%dn",getppid(),getpid());
        sleep(3);
        printf("nChild process here,now its a orphan process,so init is my parent
process now n");
        printf("nchild here...Parent id=%d,Process id=%dn",getppid(),getpid());
        /*its clearly evident in the o/p that the parent process Id of the child
process will now be =1,
          the init process is made as a parent */
    }
    else{
        sleep(1);
        /*since parent process finishes earlier than the child ,the latter becomes
a orphan process */
        printf("nparent process here n");
        printf("nparent process..Process id=%dn",getpid());
        printf("nparent process Exiting,making the child process a orphan .......
nn") ;

    }
}

More Related Content

What's hot (20)

Sol8
Sol8Sol8
Sol8
 
8.2
8.28.2
8.2
 
Thread介紹
Thread介紹Thread介紹
Thread介紹
 
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!..."A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
"A 1,500 line (!!) switch statement powers your Python!" - Allison Kaptur, !!...
 
Scripting ppt
Scripting pptScripting ppt
Scripting ppt
 
Vcs8
Vcs8Vcs8
Vcs8
 
Rcpp11 genentech
Rcpp11 genentechRcpp11 genentech
Rcpp11 genentech
 
3 rd animation
3 rd animation3 rd animation
3 rd animation
 
Loop
LoopLoop
Loop
 
Looping in C
Looping in CLooping in C
Looping in C
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
Advanced Scripting - 2 (Ch-8)
Advanced Scripting - 2 (Ch-8)Advanced Scripting - 2 (Ch-8)
Advanced Scripting - 2 (Ch-8)
 
[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...
[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...
[DevDay2018] How does JavaScript actually work? - By: Vi Nguyen, Senior Softw...
 
C++
C++C++
C++
 
R/C++ talk at earl 2014
R/C++ talk at earl 2014R/C++ talk at earl 2014
R/C++ talk at earl 2014
 
week-16x
week-16xweek-16x
week-16x
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADLoad-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
 
関西アンカンファレンス PHP ではじめるテストコード
関西アンカンファレンス PHP ではじめるテストコード関西アンカンファレンス PHP ではじめるテストコード
関西アンカンファレンス PHP ではじめるテストコード
 
Sender
SenderSender
Sender
 
FSE 2008
FSE 2008FSE 2008
FSE 2008
 

Viewers also liked

Sesiã³n 1 de 6 desarrollo de proyectos ixtapaluca
Sesiã³n 1 de 6 desarrollo de proyectos ixtapalucaSesiã³n 1 de 6 desarrollo de proyectos ixtapaluca
Sesiã³n 1 de 6 desarrollo de proyectos ixtapalucaUSET
 
Superb Lenovo Laptops and their Models
Superb Lenovo Laptops and their ModelsSuperb Lenovo Laptops and their Models
Superb Lenovo Laptops and their ModelsEvetech
 
VIVIANA PUERTA English Homework
VIVIANA PUERTA English Homework VIVIANA PUERTA English Homework
VIVIANA PUERTA English Homework viviana puerta
 
MANEJO DEL PANEL DE CONTROL Y DESINSTALACION DE UNA APLICACION
MANEJO DEL PANEL DE CONTROL Y DESINSTALACION DE UNA APLICACIONMANEJO DEL PANEL DE CONTROL Y DESINSTALACION DE UNA APLICACION
MANEJO DEL PANEL DE CONTROL Y DESINSTALACION DE UNA APLICACIONEfrain Nava Ceja
 
Cronos Seminar 28 May 2015
Cronos Seminar 28 May 2015Cronos Seminar 28 May 2015
Cronos Seminar 28 May 2015CommaGroup
 
A φτηνα εργατικα χερια !!!
A φτηνα εργατικα χερια  !!!A φτηνα εργατικα χερια  !!!
A φτηνα εργατικα χερια !!!Stauros Genoardo
 
Citta 2 invånartidning_svenska
Citta 2 invånartidning_svenskaCitta 2 invånartidning_svenska
Citta 2 invånartidning_svenskaUlf Grindgards
 
Sql Server 2008 Product Overview
Sql Server 2008 Product OverviewSql Server 2008 Product Overview
Sql Server 2008 Product OverviewIsmail Muhammad
 
LCI -SA Minutes 7th March
LCI -SA Minutes 7th MarchLCI -SA Minutes 7th March
LCI -SA Minutes 7th Marchdanmrrt
 

Viewers also liked (16)

Sesiã³n 1 de 6 desarrollo de proyectos ixtapaluca
Sesiã³n 1 de 6 desarrollo de proyectos ixtapalucaSesiã³n 1 de 6 desarrollo de proyectos ixtapaluca
Sesiã³n 1 de 6 desarrollo de proyectos ixtapaluca
 
Primera lectura clinica_p
Primera lectura clinica_pPrimera lectura clinica_p
Primera lectura clinica_p
 
Superb Lenovo Laptops and their Models
Superb Lenovo Laptops and their ModelsSuperb Lenovo Laptops and their Models
Superb Lenovo Laptops and their Models
 
VIVIANA PUERTA English Homework
VIVIANA PUERTA English Homework VIVIANA PUERTA English Homework
VIVIANA PUERTA English Homework
 
MANEJO DEL PANEL DE CONTROL Y DESINSTALACION DE UNA APLICACION
MANEJO DEL PANEL DE CONTROL Y DESINSTALACION DE UNA APLICACIONMANEJO DEL PANEL DE CONTROL Y DESINSTALACION DE UNA APLICACION
MANEJO DEL PANEL DE CONTROL Y DESINSTALACION DE UNA APLICACION
 
Cronos Seminar 28 May 2015
Cronos Seminar 28 May 2015Cronos Seminar 28 May 2015
Cronos Seminar 28 May 2015
 
Salmo 146:11
Salmo 146:11Salmo 146:11
Salmo 146:11
 
smalBiz
smalBizsmalBiz
smalBiz
 
La Doctrina 19
La Doctrina 19La Doctrina 19
La Doctrina 19
 
A φτηνα εργατικα χερια !!!
A φτηνα εργατικα χερια  !!!A φτηνα εργατικα χερια  !!!
A φτηνα εργατικα χερια !!!
 
Citta 2 invånartidning_svenska
Citta 2 invånartidning_svenskaCitta 2 invånartidning_svenska
Citta 2 invånartidning_svenska
 
Sql Server 2008 Product Overview
Sql Server 2008 Product OverviewSql Server 2008 Product Overview
Sql Server 2008 Product Overview
 
детский кибо
детский кибодетский кибо
детский кибо
 
Treball cartes d_hivern_power2
Treball cartes d_hivern_power2Treball cartes d_hivern_power2
Treball cartes d_hivern_power2
 
LCI -SA Minutes 7th March
LCI -SA Minutes 7th MarchLCI -SA Minutes 7th March
LCI -SA Minutes 7th March
 
Labmetrics Januar 2013
Labmetrics Januar 2013Labmetrics Januar 2013
Labmetrics Januar 2013
 

Similar to Forkexpe

ood evening people. Ive been working on this code that sends a bur.pdf
ood evening people. Ive been working on this code that sends a bur.pdfood evening people. Ive been working on this code that sends a bur.pdf
ood evening people. Ive been working on this code that sends a bur.pdfaroramobiles1
 
OS presentation (1).pptx
OS presentation (1).pptxOS presentation (1).pptx
OS presentation (1).pptxJenish62
 
Consider the fork_examplec code under Example code for pr.pdf
Consider the fork_examplec code under Example code for pr.pdfConsider the fork_examplec code under Example code for pr.pdf
Consider the fork_examplec code under Example code for pr.pdfabinayamobiles
 
Unit 5
Unit 5Unit 5
Unit 5siddr
 
A CTF Hackers Toolbox
A CTF Hackers ToolboxA CTF Hackers Toolbox
A CTF Hackers ToolboxStefan
 
UNIX_Process Control_Module3.pptx
UNIX_Process Control_Module3.pptxUNIX_Process Control_Module3.pptx
UNIX_Process Control_Module3.pptxraunakkumar290158
 
Unit 6
Unit 6Unit 6
Unit 6siddr
 
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsSystem Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsashukiller7
 
Mychurch File Upload
Mychurch File UploadMychurch File Upload
Mychurch File UploadJoe Suh
 
Tested on ubuntu,Linux#include stdio.h #include string.h.pdf
Tested on ubuntu,Linux#include stdio.h #include string.h.pdfTested on ubuntu,Linux#include stdio.h #include string.h.pdf
Tested on ubuntu,Linux#include stdio.h #include string.h.pdfaquacare2008
 
Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHPThomas Weinert
 
6. processes and threads
6. processes and threads6. processes and threads
6. processes and threadsMarian Marinov
 
What is-a-computer-process-os
What is-a-computer-process-osWhat is-a-computer-process-os
What is-a-computer-process-osManish Singh
 

Similar to Forkexpe (20)

ood evening people. Ive been working on this code that sends a bur.pdf
ood evening people. Ive been working on this code that sends a bur.pdfood evening people. Ive been working on this code that sends a bur.pdf
ood evening people. Ive been working on this code that sends a bur.pdf
 
process creation OS
process creation OSprocess creation OS
process creation OS
 
OS presentation (1).pptx
OS presentation (1).pptxOS presentation (1).pptx
OS presentation (1).pptx
 
Ipc
IpcIpc
Ipc
 
Os lab final
Os lab finalOs lab final
Os lab final
 
Consider the fork_examplec code under Example code for pr.pdf
Consider the fork_examplec code under Example code for pr.pdfConsider the fork_examplec code under Example code for pr.pdf
Consider the fork_examplec code under Example code for pr.pdf
 
Unit 5
Unit 5Unit 5
Unit 5
 
A CTF Hackers Toolbox
A CTF Hackers ToolboxA CTF Hackers Toolbox
A CTF Hackers Toolbox
 
UNIX_Process Control_Module3.pptx
UNIX_Process Control_Module3.pptxUNIX_Process Control_Module3.pptx
UNIX_Process Control_Module3.pptx
 
Unit 6
Unit 6Unit 6
Unit 6
 
forkwork.pptx
forkwork.pptxforkwork.pptx
forkwork.pptx
 
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbsSystem Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
System Calls.pptxnsjsnssbhsbbebdbdbshshsbshsbbs
 
Mychurch File Upload
Mychurch File UploadMychurch File Upload
Mychurch File Upload
 
Tested on ubuntu,Linux#include stdio.h #include string.h.pdf
Tested on ubuntu,Linux#include stdio.h #include string.h.pdfTested on ubuntu,Linux#include stdio.h #include string.h.pdf
Tested on ubuntu,Linux#include stdio.h #include string.h.pdf
 
Fork handout
Fork handoutFork handout
Fork handout
 
Unix kernal
Unix kernalUnix kernal
Unix kernal
 
Sysprog 11
Sysprog 11Sysprog 11
Sysprog 11
 
Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHP
 
6. processes and threads
6. processes and threads6. processes and threads
6. processes and threads
 
What is-a-computer-process-os
What is-a-computer-process-osWhat is-a-computer-process-os
What is-a-computer-process-os
 

More from Karthic Rao

More from Karthic Rao (10)

Scaling your GraphQL applications with Dgraph
Scaling your GraphQL applications with DgraphScaling your GraphQL applications with Dgraph
Scaling your GraphQL applications with Dgraph
 
Childexittest
ChildexittestChildexittest
Childexittest
 
Childexittest
ChildexittestChildexittest
Childexittest
 
Fileinc
FileincFileinc
Fileinc
 
Usrinfogetpwuid
UsrinfogetpwuidUsrinfogetpwuid
Usrinfogetpwuid
 
Countrytime.c
Countrytime.cCountrytime.c
Countrytime.c
 
Timesleep
TimesleepTimesleep
Timesleep
 
Time2.c
Time2.cTime2.c
Time2.c
 
Fork.c
Fork.cFork.c
Fork.c
 
2 buffer overflows
2 buffer overflows2 buffer overflows
2 buffer overflows
 

Recently uploaded

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 

Recently uploaded (20)

Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 

Forkexpe

  • 1. /* Hackintoshrao:codes for GNU/LINUX ILLUSTRATION OF ORPHAN PROCESS AND ASSIGNMENT OF INIT AS A PARENT TO SUCH A PROCESS SYSTEM CALLS USED 1.fork() 2.getpid() 3.getppid() 4.sleep() */ #include<stdlib.h> #include<unistd.h> #include<time.h> int main() { int pid; pid=fork(); if(pid==0) { printf("nChild process here n"); printf("nchild here..Parent id=%d,Process id=%dn",getppid(),getpid()); sleep(3); printf("nChild process here,now its a orphan process,so init is my parent process now n"); printf("nchild here...Parent id=%d,Process id=%dn",getppid(),getpid()); /*its clearly evident in the o/p that the parent process Id of the child process will now be =1, the init process is made as a parent */ } else{ sleep(1); /*since parent process finishes earlier than the child ,the latter becomes a orphan process */ printf("nparent process here n"); printf("nparent process..Process id=%dn",getpid()); printf("nparent process Exiting,making the child process a orphan ....... nn") ; } }