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

RE: Files



THere won't be nay problem because the file descriptor won't shared by
different process. The made public only if u completed ur work. Still you
can lock the file using flock(fd,flgas) in exclusive mode, so that you can
avoid race conditions.

Thanks,
Kondaiah Dasari 

> -----Original Message-----
> From:	Harpreet Singh (RBIN/DCA-NMP) [SMTP:Harpreet.Singh@xxxxxxxxxxxx]
> Sent:	Thursday, December 07, 2000 9:52 AM
> To:	linux-india-programmers@xxxxxxxxxxxxxxxxxxxxx
> Subject:	RE: [LIP] Files
> Importance:	High
> 
> Ok, so two processes can access the same file at the same time.
> If both open it for reading there is no problem. But If one opens it for
> reading
> and one for writing, won't there be a problem.
> 
> Also is it possible to lock a file. In the sense that if it has been
> opened
> it cannot be used by another
> program or process.
> 
> > -----Original Message-----
> > From:	Ramesh.S [SMTP: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
> 
> ---------------------------------------------
> LIP is all for free speech.  But it was created
> for a purpose.  Violations of the rules of
> this list will result in stern action.