I know the fork concept.
I try to solve the problem.
I do the one fork() process and the fork() process create the one parent and child.
If I run the program and i put the arguments of the commands.
I'm creating a parent-child process in C and these processes are using an array of characters as a shared memory and i want the execution to be in this sequence
parent->child->parent->child->parent->child .... and so on, i am using Wait(NULL) in parent but the execution go in the sequence of parent->child->parent->parent->parent ....
According to wikipedia (which could be wrong)
When a fork() system call is issued, a copy of all the pages corresponding to the parent process is created, loaded into a separate memory location by the OS for the child process. But this is not needed in certain cases.
See In Example1, the parent process is being called first ,where as in the Example 2
the child process has been called first .
The parent process fails with errno=12(Out of memory) when it tries to fork a child. The parent process runs on Linux 3.0 kernel - SLES 11. At the point of forking the child, the parent process has already used up around 70% of the RAM(180GB/256GB). Is there any workaround for this problem?
The application is written in C++, compiled with g++ 4.6.3.
This program gets a sentence in parent process and prints it in upper case in child process. I want the child to wait for the parent. I used sleep() to make the child process to wait. Is there any method of making a child to wait for the parent ? Can i implement that with signal() ?
I actually wanted to learn about the pipe() command and so I thought I'll fork() a child, take input of an integer array from user in parent process, send that array to child using pipe() and and print the array via child process.
While doing this, I am struck with taking input of the array in the parent process at the first place...Whenever I dynamically create an array, say of 5 elements, it ta
I am trying to use shm_unlink(object_path) to clear up the shared memory I opened in signal handling function. However, the code doesn't work. What goes wrong? The code basically does this: A parent process is taking two integers from user input, and fork a child to compute the sum of the two. Once the sum is computed, the child informs the parent that it's done computing sum through a pipe.
In my C program, I keep a struct linked list as a global variable.
Then later I fork a child process. Now in the child process if I free a node of the linked list, and then end the child process. Will the node be gone in the parent process as well?
When I was trying this, it seems the node was still there in the parent process...
Is this right? Why?