how many processes will be created when i fork() twice .

Is this logic correct ?

the 1st fork will spawn child C1 which is a child of the parent process P.
the code segment of the parent P is inherited by C1.
the 2nd fork is called by both P and C1.
P gets another child C2 and C1 its first child C3.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.