Two Programming Questions
Conor P. Cahill
cpcahil at virtech.uucp
Tue Aug 28 09:00:44 AEST 1990
In article <380 at icjapan.uucp> jimmy at denwa.info.com (Jim Gottlieb) writes:
>time out and complete after a certain time-out period has elapsed. He
>says that TFM explains how to do this but it does not work; it never
>times out. I suggested that he first try installing the FAS driver,
This should work. I would suggest that you post a portion of the code
that is having the problem so we can pick it apart.
>He also wonders if there is some way to write-lock shared memory.
Nope. Like a file descriptor, once you have gotten access to the
item, the mode of access cannot be changed.
>contents of a certain shared memory segment. If not, I guess we can
>always kludge around the problem by using the presence of a "lock" file
>to indicate whether it is OK to write to that shared memory, or we can
Or you could use a semaphore (or with the right code, use part of the
shared memory to set a flag that means you can write to it - Before you
people try to jump on this, I know that a simple flag will not work since
both processes could check and/or set the flag at the same time. A
combination of flags and code is required).
>just forget about using shared memory and use a real file with file
>locking instead. If it is being constantly accessed, it will be in
>memory anyway.
While it may be in the block buffer cache, each operation will still
require :
a) a system call (read/write)
b) an inode update
c) a search through the buffer cache
d) data copying from your user buffer to a system buffer
Much less efficient than using shared memory (hence the reason that many,
if not all, of the major database manufacturers are using shared memory
for database caching, if possible)
--
Conor P. Cahill (703)430-9247 Virtual Technologies, Inc.,
uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160
Sterling, VA 22170
More information about the Comp.unix.i386
mailing list