LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-21-2011, 01:25 PM   #1
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Rep: Reputation: 62
How does file locking work in Linux?


I have a situation in an office where a LAN will be installed - what I want to know is, after that, can 2 people open the same spreadsheet file, i.e. the person on the computer that it's on, as well as somebody across the LAN?

Thanks.
 
Old 04-21-2011, 02:35 PM   #2
poorsod
LQ Newbie
 
Registered: Apr 2011
Posts: 16

Rep: Reputation: 3
Quote:
Originally Posted by resetreset View Post
I have a situation in an office where a LAN will be installed - what I want to know is, after that, can 2 people open the same spreadsheet file, i.e. the person on the computer that it's on, as well as somebody across the LAN?

Thanks.
Linux lets you use file locking, or not. It's up to the programmer basically. If you're using a spreadsheet Open Office :
Quote:
If you are working on a network where several people may have access to the same document, file locking prevents people accidentally overwriting other people's changes. As OpenOffice.org works on different operating systems, it cannot rely on the operating system alone to tell users when a document is in use. OpenOffice.org now has its own mechanism, which allows it to have a reliable locking when the locking from the operating systems fails.
It's only written to when the user clicks 'save' and that's pretty brief. Without locking if one guy saved something, then another guy saved something, that second guy would overwrite the first guys saved data. That's why openoffice uses locking - and it should!
I'm pretty sure anyone will be able to download/copy the file if they're accessing it with something like an ftp or samba server or something. But when it comes to writing to it the file, proper locking should be implemented by the program to prevent race-condition scenarios. That's all OS independent though.

Last edited by poorsod; 04-21-2011 at 02:36 PM.
 
Old 04-21-2011, 06:40 PM   #3
spankbot
Member
 
Registered: Aug 2007
Posts: 133

Rep: Reputation: 16
Quote:
Originally Posted by resetreset View Post
I have a situation in an office where a LAN will be installed - what I want to know is, after that, can 2 people open the same spreadsheet file, i.e. the person on the computer that it's on, as well as somebody across the LAN?

Thanks.
Two people will be able to open the file at the same time with no problems. The issues comes when two people try to save the file at the same time. As a poster above correctly points out, this is called a "race condition". This isn't a Linux specific issue - all networkable OS's have to deal with this.

If you need to allow more than one person to edit and change a file, you should implement some sort or version control system, like Git (http://git-scm.com/) or Subversion (http://subversion.apache.org/).

Last edited by spankbot; 04-21-2011 at 06:42 PM.
 
Old 04-22-2011, 12:58 AM   #4
resetreset
Senior Member
 
Registered: Mar 2008
Location: Cyberspace
Distribution: Dynebolic, Ubuntu 10.10
Posts: 1,340

Original Poster
Rep: Reputation: 62
Quote:
Originally Posted by spankbot View Post
Two people will be able to open the file at the same time with no problems.

Will there be any message popping up to say that the file is already in use by someone else? (like happens in Windoze)?
 
Old 04-22-2011, 03:05 PM   #5
spankbot
Member
 
Registered: Aug 2007
Posts: 133

Rep: Reputation: 16
Quote:
Originally Posted by resetreset View Post
Will there be any message popping up to say that the file is already in use by someone else? (like happens in Windoze)?
Possibly. Depends on the software being used to open the file, how the network is setup, are you using nfs, etc.

If it were two people on the same computer, using VI to open the file, then in that particular scenario you would get a warning...

Sounds like you really need some sort of version control. A Subversion server would take care of these issues for you. And your users would be able to use what ever OS they wanted as there are subversion clients for all platforms.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux File Locking Mechanism Samrat_Chakravarty Linux - Kernel 1 07-07-2010 12:50 PM
Linux Hpux NFS file locking clarkem Linux - Networking 1 08-24-2006 12:38 PM
File Locking not working from Linux via Samba to Win marisdembovskis Linux - Networking 0 06-08-2006 07:59 AM
file locking in linux? sunpascal Linux - Newbie 8 03-15-2006 08:00 PM
File locking in Linux xailer Programming 5 12-29-2003 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration