Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


  Search this Thread
Old 07-07-2010, 11:19 AM   #1
LQ Newbie
Registered: Jul 2010
Posts: 1

Rep: Reputation: 0
Linux File Locking Mechanism

Hi Folks,

I have a situation where the one process 1 is writing files on Linux server and process 2 is polling for newly created files and reads them , making a copy and passes to another process.

Now, I want to know that is it possible that process 2 can read a file before the process 1 completely write it. Is there any kind of automatic kinda locking mechanism in Linux which stops process 2 to read the file before process 1 completely write it.

Any kind of help will be appreciable.

Old 07-07-2010, 12:50 PM   #2
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Named pipes/FIFOs might be one option. For a quick introduction, see for example this page on Linux Journal. The idea is that one program writes to a special place and the other one reads when it finds information there.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
VPATH mechanism in make file sonu kumar Linux - Newbie 1 01-11-2010 11:42 AM
Is there any locking mechanism in linux scriptblues Linux - Newbie 7 06-12-2009 05:57 AM
Linux Traditional File Access Mechanism dolphine Linux - General 2 09-27-2006 02:43 PM
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 > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 01:38 AM.

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