Search the web
Sign In
New User? Sign Up
linux-bangalore-programming · LB Programming Discussions
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
fork() - understanding the memory space of parent and child   Message List  
Reply | Forward Message #7536 of 7596 |
Re: [blug-prog] fork() - understanding the memory space of parent and child

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




Thu Apr 30, 2009 9:53 pm

sridhar.iyer
Offline Offline
Send Email Send Email

Forward
Message #7536 of 7596 |
Expand Messages Author Sort by Date

My queries are : 1. how the fork actually works regarding the memory space of child and parent 2. the below code shows same address for a auto variable "var" ,...
vin_vrs
Online Now Send Email
Apr 3, 2009
1:33 pm

I am just making an assumption. May be only the offset is same; physical addresses may be different. Regards, Joe. ________________________________ From:...
Joe Cheri Ross
joecheriross
Offline Send Email
Apr 4, 2009
6:08 am

... Pick any OS related book(Silberchantz is well known) for an in depth intro. ... Those are two different variables in two different address spaces. fork ...
Sridhar.V.Iyer
sridhar.iyer
Offline Send Email
May 1, 2009
4:15 am

Hi Vinod, calling fork or any family of fork calls will call the "clone" system call with different parameters. Most implementations of pthreads also call the ...
Rajesh T N
rajeshatn
Offline Send Email
May 2, 2009
6:58 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help