Re: Concurrent read/writes on the same file

Stephen C. Tweedie (sct@redhat.com)
Tue, 8 Dec 1998 12:26:53 GMT


Hi,

On 07 Dec 98 20:38:42 +0330, "HARAWAT.IN.ORACLE.COM"
<HARAWAT.IN.oracle.com.ofcmail@in.oracle.com> said:

> In FreeBSD the vn_read function looks like this
> lock the vnode
> do the actual read
> unlock the vnode

> So it means that one read/write will execute in the kernel at one
> point of time, the second read/write will block while trying to lock
> the vnode. Is the same algo used in Linux also.

No. In Linux, writes are locked in this way, but only while we
are copying the user data into the kernel writeback buffers. Once the
write() system call is complete, we drop the lock and perform the data
write asynchronously. Reads are not locked.

> Is the same algo used for the Raw Devices as well.

No, the raw device implementation I'm currently finishing off for 2.1
does not lock the IO regions at all. It _does_ lock the user's IO
buffer, so you cannot perform concurrent writes from the same buffer to
different areas of disk, but you can safely submit multiple outstanding
IOs from different buffers.

The existing (non-raw) block devices on Linux do not lock at all.

--Stephen

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