public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: J Lumby <johnlumby@hotmail.com>
To: Peng Yu <pengyu.ut@gmail.com>
Cc: Peng Yu via Libc-help <libc-help@sourceware.org>,
	Florian Weimer <fweimer@redhat.com>
Subject: Re: What is the point of IPC_PRIVATE of shmget?
Date: Mon, 12 Apr 2021 14:17:46 -0400	[thread overview]
Message-ID: <DM6PR06MB5562DAA98DFFCC08B96C9831A3709@DM6PR06MB5562.namprd06.prod.outlook.com> (raw)
In-Reply-To: <CABrM6wmFq3Nqs-5uQ3TEaHCrzrPABeUsS6pFcTxpf6fyLMJ23Q@mail.gmail.com>

For the (common) case of parent process which forks children and wants 
all to be able to access common memory,  another alternative is to use 
mmap.    postgresql used to use shmget but since V9.3 has switched most 
shared memory areas to mmap.   Here is why:

from src/backend/port/sysv_shmem.c

  * This works around the problem that many
  * systems have very low limits on the amount of System V shared memory
  * that can be allocated.  Even a limit of a few megabytes will be enough
  * to run many copies of PostgreSQL without needing to adjust system 
settings.

Cheers,   John

On 4/12/21 1:23 PM, Peng Yu via Libc-help wrote:
>> Oh, it can be shared if the process forks.  With malloc, you'd lose the
>> sharing.
> OK. This makes much more sense now.
>

  reply	other threads:[~2021-04-12 18:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 15:54 Peng Yu
2021-04-12 16:06 ` tomas
2021-04-12 16:07 ` Florian Weimer
2021-04-12 16:12   ` Peng Yu
2021-04-12 16:14     ` Florian Weimer
2021-04-12 16:18       ` Florian Weimer
2021-04-12 17:23       ` Peng Yu
2021-04-12 18:17         ` J Lumby [this message]
2021-04-12 17:55       ` Manfred
2021-04-12 19:05         ` Peng Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR06MB5562DAA98DFFCC08B96C9831A3709@DM6PR06MB5562.namprd06.prod.outlook.com \
    --to=johnlumby@hotmail.com \
    --cc=fweimer@redhat.com \
    --cc=libc-help@sourceware.org \
    --cc=pengyu.ut@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).