[comp.databases] record locking in C-tree on bsd unix

deepak@ncst.ernet.in (Deepak G Patil) (06/25/91)

Does any one know how to lock records in C-tree on bsd unix ?

to my knowledge to lock records C-tree uses system call,
and bsd unix doesn't support any system call to lock a record in a file,

has any one implemented record locking under bsd unix? any pointers
will be highly appreciated.

thanks in advance.
Deepak

jhc@ivan.uucp (James H. Coombs) (06/25/91)

In article <1991Jun25.091645.28309@ncst.ernet.in> deepak@ncst.ernet.in (Deepak G Patil) writes:
>Does any one know how to lock records in C-tree on bsd unix ?
>
>to my knowledge to lock records C-tree uses system call,
>and bsd unix doesn't support any system call to lock a record in a file,

c-tree invokes lockf().  I find that when we were working on the IBM
RT, I defined lockf() to (0), but I did not have a multi-user
application on that machine.

There are many ways to implement locking:

	1. Write a lock demon that mediates between processes.

	2. Use a multi-threaded server that keeps track of locked
	records.

	3. Put a flag in each record to indicate whether or not it is
	locked.

	4. If simultaneous locking is limited, use flock() and lock
	the entire table.

--Jim