Subject: Re: some questions.

From: [email-masked] (Paul M. Aoki)
Date: Tue, 14 Sep 93 21:06:50 -0700

[email-masked] (kim kyongsok) writes:
> 1.  postgres uses shared memory.  does shared memory reside on real
> memory or on virtual memory (and thus paged).

the system v shared memory interface works with virtual addresses.
you attach a segment to your virtual address space with shmat(3).
shared memory segments can be paged (SHM_UNLOCK) or unpaged (SHM_LOCK).
this is supposed to be controlled by shmctl(3).

postgres never does SHM_LOCK.  i think many versions of unix
default to SHM_LOCK behavior -- sunos3, for example.  but sunos 
does not document SHM_LOCK.  on ultrix, you *can* call 
shmctl(SHM_LOCK) explicitly but you have to be uid 0.. hpux has
similar restrictions.

so, since no version of unix really lets you set page/no-page as a
regular user, postgres has to settle for whatever the OS provides
by default.  (or run as root.  probably a bad idea :-)

you can look at the man pages, <sys/shm.h> and the kernel source
if you're really interested.  if you want to publish this somewhere
don't take my word for it -- check the kernel source.

> 2.  is postgres's buffer for database pages in shared memory?

yes.

> 2.  a related question.  does postgres's buffer for database pages
> reside on real memory or on virtual memory?

"related"?  this is the same as question 1 + question 2..
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  [email-masked]
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki