The title of my thread says it all..
I've just started learning Operating System.. My question may seems very stupid to you.. but honestly I don't any thing about that really..
I'm just really confused what process does fork(); command creates ??
And my second question why do we need fork(); to create process ??
E.g In my opinions x=4+6 is also a process..
I've seen many examples of using fork(); function but.. what they all did is nothing.. just an output message "I'm a parent with child ID=3867" and blah blah blah.. what does this program do ??
Thanks in advance..
Fork clones the current process, then the new process calls one of the exec() functions to load a new executable. There's probably more to it but that is the gist of it.
Have you looked at the man pages for fork() and exec()?
fork() creates a new process by duplicating the calling process. The new process,
referred to as the child, is an exact duplicate of the calling process, referred to as
the parent, except for the following points:
The execution of a software program over the time is called a process. Its state is defined by its variable assignments. Forking a process duplicates its variables along with their current assignments. From now on there are two threads of execution changing state of their own set of variables possibly in a different manner.