Re: [HACKERS] why do shmem attach?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Vadim Mikheev <vadim(at)krs(dot)ru>
Cc: PostgreSQL Developers List <hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] why do shmem attach?
Date: 1999-09-20 13:55:19
Message-ID: 13533.937835719@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Vadim Mikheev <vadim(at)krs(dot)ru> writes:
> Also, all this ShmemIndex stuff seems to be useless
> (except of backend PID lookup but it's for sure
> should be in separate hash table).

Have I got a deal for you ;-). I have uncommitted changes that add
a pointer (SHMEM_OFFSET that is) to each backend's PROC struct into
the per-backend info array that already existed in shmem.c. The
routines in shmem.c that searched for PROC structures are now in
sinval.c, and just do a simple scan of the ProcState array to find
the PROC structs. They should be a whole lot faster --- which is
good since these things run with spinlocks held...

These changes are intermixed with other things that are currently
triggering a lot of NOTICE: Buffer Leak messages in the regress tests,
so I don't want to commit until I've puzzled out the buffer refcount
issue. But I've got 'em and they seem to work fine.

> And why separate shmem segment (!!!) is used for
> Slocks (ipc.c:CreateAndInitSLockMemory(), etc) - they
> use so small amount of memory!

Historical reasons I suppose. shmem.c does assume that spinlocks
are already up and running when it is initialized, so combining
everything into one segment would require care. But it's surely
doable if someone wants to take the time. (I don't.)

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-09-20 14:00:39 Re: [HACKERS] Notice: heap_open/close changes committed
Previous Message Leon 1999-09-20 13:50:12 Re: [HACKERS] All things equal, we are still alot slower then MySQL?