[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: Files



Hi Ramesh,
	Your arg is not wholly correct , but I like your approach.

	The fork thing will work even on Windows but the file thing will
not.So your reasoning is applicable to Unix. 
	
	Moreover, when you fork, the variable in question [i] has two
separate existences in two separate process spaces [stack/data area depends
on the block]. /however the file has only one existence in the physical
world on the storage device. The file pointers will be pointinf to the same
physical object. So in the latter case, it is more likely that you will run
into race conditions/synchronization errors, data obsolescence problems etc.

Regards,
Shourya

_______________________________________________
Shourya Sarcar || Global Software Platforms
gemedicalsystems.com || ge.com || elfun.org
5263121 xt 362 || shourya@xxxxxxxxxxx



~-----Original Message-----
~From: Ramesh.S [mailto:ramesh_tnj@xxxxxxxxx]
~Sent: Wednesday, December 06, 2000 9:26 AM
~To: linux-india-programmers@xxxxxxxxxxxxxxxxxxxxx
~Subject: Re: [LIP] Files
~
~
~yeah... it is possible.. i found a lot of replies like this.. to tell
~u the actual reason, it is like two processes accessing the same
~memory..
~
~suppose think of the followin gblock of code in the same program
~
~int i=5;
~fork();
~i++;
~printf("%d",i);
~
~here in the above code after fork a seperate copy of the saem memory
~is inherited from the parent process. therefore every process will
~have its own resource copy. to be more clear...
~every process will have its own process table entry and file tabel
~entry. so same file can be accessed by two different processes at the
~same time. even i am also a begineer.. i am not sure with my answer.
~if anybody finds and misconception here kindly correct me...
~
~Ramesh.
~
~
~
~----- Original Message -----
~From: Harpreet Singh (RBIN/DCA-NMP)
~To: linux-india-programmers@xxxxxxxxxxxxxxxxxxxxx
~Sent: Monday, December 04, 2000 7:02 PM
~Subject: [LIP] Files
~
~
~Hi,
~
~When a file is opened for reading by one program, can the same file be
~opened for reading by another program at the same time.
~And when this file is opened for reading by one program, can the same
~file
~be opened for writing or updation by another program at the same time.
~
~From :
~Harpreet Singh
~Software Eng.
~(DCA/NMP)
~Robert Bosch India Pvt. Limited.
~123, Industrial Layout,
~Hosur Road, Koramangala,
~Bangalore,
~Karnataka,
~India.
~Ph  : 508-1145
~
~
~
~
~
~---------------------------------------------
~The mailing list archives are available at
~http://lists.linux-india.org/cgi-bin/wilma/LIP
~
~
~__________________________________________________
~Do You Yahoo!?
~Talk to your friends online with Yahoo! Messenger.
~http://im.yahoo.com
~
~---------------------------------------------
~An alpha version of a web based tool to manage
~your subscription with this mailing list is at
~http://lists.linux-india.org/cgi-bin/mj_wwwusr
~