lkml.org 
[lkml]   [2003]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Lockless file reading
From
Date
On Wed, 2003-08-27 at 21:42, Nagendra Singh Tomar wrote:
> Hi,
> I beleive ur original post was to address the case of a reader reading
> a file getting *incorrect* data due to the file being written
> simultaneously by another writer process.

Well, "old" data, which mixed with new data would become incorrect as a
whole.

> Why do u require file locking if there is a *single* writer ?? I don't
> understand why a 123 written over XXX can result in 1X3. The kernel should
> take care of this. When the writer process is writing 123 it will first be
> written to the page cache. The page cache lock will be taken inside the
> kernel before writing to it, so we know that writing 123 over XXX will be
> atomic. Now even when this page is flushed to disk, the page lock would
> be taken. So I cannot see a possibility of 123 written over XXX being read
> as 1X3.

That was my original plan, to just rely on such kernel behaviour. I just
don't know if it's such a good idea to rely on that, especially if I
want to keep my program portable. I'll probably fallback to that anyway
if my checksumming ideas won't work.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.100 / U:3.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site