1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

Implement new 'lightweight lock manager' that's intermediate between

existing lock manager and spinlocks: it understands exclusive vs shared
lock but has few other fancy features.  Replace most uses of spinlocks
with lightweight locks.  All remaining uses of spinlocks have very short
lock hold times (a few dozen instructions), so tweak spinlock backoff
code to work efficiently given this assumption.  All per my proposal on
pghackers 26-Sep-01.
This commit is contained in:
Tom Lane
2001-09-29 04:02:27 +00:00
parent 818fb55ac4
commit 499abb0c0f
46 changed files with 1595 additions and 1355 deletions

View File

@@ -7,14 +7,13 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: shmem.h,v 1.30 2001/09/07 00:27:30 tgl Exp $
* $Id: shmem.h,v 1.31 2001/09/29 04:02:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef SHMEM_H
#define SHMEM_H
#include "storage/spin.h"
#include "utils/hsearch.h"
@@ -55,9 +54,6 @@ extern DLLIMPORT SHMEM_OFFSET ShmemBase;
(((xx_offs) != 0) && ((xx_offs) != INVALID_OFFSET))
extern SPINLOCK ShmemLock;
extern SPINLOCK ShmemIndexLock;
/* shmemqueue.c */
typedef struct SHM_QUEUE
{
@@ -66,16 +62,15 @@ typedef struct SHM_QUEUE
} SHM_QUEUE;
/* shmem.c */
extern void InitShmemAllocation(PGShmemHeader *seghdr);
extern void InitShmemAllocation(void *seghdr);
extern void *ShmemAlloc(Size size);
extern bool ShmemIsValid(unsigned long addr);
extern void InitShmemIndex(void);
extern HTAB *ShmemInitHash(char *name, long init_size, long max_size,
HASHCTL *infoP, int hash_flags);
extern void *ShmemInitStruct(char *name, Size size, bool *foundPtr);
typedef int TableID;
/* size constants for the shmem index table */
/* max size of data structure string name */
#define SHMEM_INDEX_KEYSIZE (50)