shared data sets on UNIX in C

Andrew T Brown atb at ncsu.UUCP
Tue Jun 12 04:10:49 AEST 1984


I am looking for information about shared data sets on the UNIX system.
We have a problem on a C program we are working on.  This problem is 
a bit confusing so bear with this explanation:

	This program may be executed by many people concurently.
	It uses a data base common to all of the users. This data
	base resides in a file so that it will be available upon
	the next execution of the program.

	First, the program reads a list of items into a linked list.
	Second, the user adds or deletes names to the linked list.
	Finally, the changes are written back to the same file.
	The problem occurs when two people are executing the program at
	the same time.  The users both read the file into their environment.
	If the first user stores his changes and then the second user stores
	his changes then the first user's changes are overwritten. 
	(wordy isn't it . . . never was good at tech writing)

	Question:  How do we keep this from happening other than reading
		   and writing the FILE on every access of the list.
		   (We don't want to be bogged down with alot of I/O)

		   Is it possible to set up a shared data set between the
		   two (or more) processes?  (If I can do that then I
		   could handle the rest of the problem)
		   How does Unix allocate its resources to different process?

Any help would be greatly welcomed. Please reply via mail.

decvax!mcnc!atb at ncsu



More information about the Comp.lang.c mailing list