LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Regarding the behavior of function fork() (https://www.linuxquestions.org/questions/programming-9/regarding-the-behavior-of-function-fork-422763/)

ramkumarv 03-08-2006 04:40 AM

Regarding the behavior of function fork()
 
Assume that we have a process which has created few semaphores,messages queues and has access to shared memory and also handles some signals. Now what will happened to all these and what are all get inherited by the child process if I do a fork().

kshkid 03-08-2006 09:45 PM

Code:

signals
The set of signals pending for the child process is initialized to the empty set. those signals set to be delivered for the parent will not be delievered to the child.
Code:

semaphores
Any semaphores that are open in the parent process shall also be open in the child process
Code:

message queues
The child process shall have its own copy of the message queue descriptors of the parent.
Code:

shared memory
shared memory segments do would be attached and the attached count would be incremented by 1.


All times are GMT -5. The time now is 03:18 AM.