Return-Path: donn@BSDI.COM 
Delivery-Date: Tue, 24 Aug 93 17:02:44 PDT
Return-Path: donn@BSDI.COM
Received: from BSDI.COM by postgres.Berkeley.EDU (5.61/1.29)
	id AA12214; Tue, 24 Aug 93 17:02:34 -0700
Received: by BSDI.COM (5.67/1.37)
	id AA25014; Tue, 24 Aug 93 20:12:05 -0400
Date: Tue, 24 Aug 93 20:12:05 -0400
From: donn@BSDI.COM (Donn Seeley)
Message-Id: <9308250012.AA25014@BSDI.COM>
To: aoki@postgres.Berkeley.EDU, mao@postgres.Berkeley.EDU
Subject: Re: ports

	From: aoki@postgres.Berkeley.EDU (Paul M. Aoki)
	To: Mike Olson <mao@postgres.Berkeley.EDU>
	Cc: donn@BSDI.COM (Donn Seeley)
	Subject: Re: ports 
	Date: Wed, 11 Aug 93 12:12:31 -0700

	Mike Olson <mao@postgres.Berkeley.EDU> writes:
	> > Thanks for the info...  Looks like we'll still have to
	> > implement those ugly System V IPC interfaces.  If you have
	> > some opinions about how to emulate System V semaphores
	> > under BSD, let me know.
	> if the hardware supports spinlocks, postgres will use those
	> rather than sysv semaphores.  i suspect the 80x86 family
	> doesn't support spinlocks.

	i was assuming that was the case -- nobody ever did spinlocks
	for our sequent box -- but i just looked and the 386 does
	have a test-and-set instruction..  :-P  ok, so i lied.
	given a shared memory emulation package (which we do not
	have right now) you could use also write a postgres spinlock
	package for 80x86 (where x>2) (which we also do not have
	right now).

	> there's an algorithm (i think called baker's algorithm)
	> for guaranteeing mutex completely at user level.  it's
	> probably in cormen, leiserson, and rivest.

	wow.  don't remember anything like that.. brian bershad
	had a paper in a recent asplos on efficient mutex on
	uniprocessors.

I have a user-mode implementation of System V shared memory with
mmap(), but it sorta seems a waste to code postgres to use it rather
than have it use mmap when the latter is available :-).  (The shm*
emulation is part of our System V binary emulator, which is under
development.)  BTW, the Bershad locking hack only works in the
kernel, as I understand it -- it relies on pre-emption.

Donn
