Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Aug 1998 03:02:55 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        green@zone.baldcom.net (Brian Feldman)
Cc:        mike@smith.net.au, freebsd-current@FreeBSD.ORG
Subject:   Re: flock(2) problem & fix
Message-ID:  <199808010302.UAA06065@usr06.primenet.com>
In-Reply-To: <Pine.BSF.4.02.9807312106510.26234-100000@zone.baldcom.net> from "Brian Feldman" at Jul 31, 98 09:08:09 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> Whoops, I suppose you're right, I think I'll start testing it out =) With
> respect to Tom's comment, this won't cnvert an exclusive to a
> non-exclusive lock, it will return EPERM; also, the program SHOULDn't be
> using an exclusive lock, it should be using a shared lock.

What if they are using it as a semaphore, and could care less whether
they were reading or writing the file?


I could see a case where a program opend a file for read only to
run an image of a program from a foreign architecture, for instance,
and would want to use read to ensure that the "swap store" was not
accidently corrupted by the simulator.

They would want exclude modification of the image they intend only to
*read* out from under them.

In other words, they want to simulate VEXEC for a read-only mapped
executable in user space.



A secondard situation would be a set of non-work-to-do processing engines
working on a source data set.

Program one opens the file, writes new data, closes it, and signals
program two.

Program two uses the file and the output of program one to do work, and
then requests the original program to interpolate new data bsed on its
results, and the process repeats.

Once could see this happening, for example, in a pseudo realtime data
analysis tool that could only accept new data on soft boundries, but
had two programs, one optimized for Fourier analysis, the other for
Gaussian reduction (maybe the Fourier analysis program was seperate
because it runs on a DSP and not on the main processor, and the DSP
is not part of the acquisition channel).

You could use such a system for all sorts of biometric regconitions
(speech, speaker, retinal scanning, finger print, etc.).  One could
even envision a "frozen" back propagation neural networking program
that had to be reset each time it was run because the outputs were
no longer being clamped by a human giving it feedback.


Anyway, suffice to say, I think exclusive locking a file without the
intention *or possibility* of writing is an "ok thing to do".


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808010302.UAA06065>