On Fri, 2009-04-03 at 12:22 +0000, vin_vrs wrote:
> My queries are :
> 1. how the fork actually works regarding the memory space of child and
> parent
Pick any OS related book(Silberchantz is well known) for an in depth
intro.
> 2. the below code shows same address for a auto variable "var" , but
> different values in case of parent and child.
> 3. how could same address contain two different values.
Those are two different variables in two different address spaces. fork
makes a parent copy as child(i.e each of them has a copy of the variable
var). vfork() will exhibit the behavior you might be looking for.
- Sridhar