[techtalk] (no subject)

Arindam Chatterjee arin_ch_77 at yahoo.com
Fri Oct 20 04:00:31 EST 2000


hi
when i run the program below:

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

main()
{
  pid_t pid;
  int x = 5, y = 9;
  pid = fork();
  if(pid == 0)
  {
    printf("child process\n addr of x = %x addr of y =
              %x\n", &x, &y);
    fflush(stdout);
  }
  else
  {
    wait(0);
    printf("parent process\n addr of x = %x addr of y
=                  %x\n", &x, &y);
    fflush(stdout);
  }
  exit(0);
}

i get the following output:

child process
 addr of x = bffffb00 addr of y = bffffafc
parent process
 addr of x = bffffb00 addr of y = bffffafc
	  
so far i know parent and child process should have
separate address space. but here the addresses are
same in both the processes. r they sharing the same
address space? then any change in parent will be
reflected in child. so why do i need pipe or fifo for
IPC? 
can anybody explain this?

arindam		


__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.
http://im.yahoo.com/




More information about the Techtalk mailing list