From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-oln040092003103.outbound.protection.outlook.com [40.92.3.103]) by sourceware.org (Postfix) with ESMTPS id 27E2F385782B for ; Mon, 12 Apr 2021 18:18:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 27E2F385782B ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YMaCMYitAPelWYhiRJYk2QQKYdpeCTgU6tqbR76OUD4N9edXuuBx6fB6FLsf7Rhj1x32XW8D6M87QpwALmheg5n4Unqua61qzesMYNmFnjSnihC8sxZzsSzc26QkZDygPwfe5XGmiSqYgdKDulvnsBJo9GO0l+3ahE3Fs4eukO8mZnMUokAsEgsW5GJqILXrWmTM46IiJBKUee8RadtwFnXEIx8rDieM++15e8Gqofs7TKoUZDPOx0owPmEyeLHmcKLQ2IGh2B2Bi4kJ7/N9DCUai4GCzqx/nCnHWqaGOE0lTIEHfnXlU4NEdXRbow0nn1ragiQxPy82RqgE2cNWDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JZvhR/RKJwPIAZ/LLMZRNnl7iCa9Kw0zHQdxkP5IMhc=; b=V9NW1I7XoPOmiFWxX2gKXT56wRzExw99i8dk14zhLLlNUFVciDoWVZDqR4NK4W88cBwmD8zTXh/U0j2TNIpk2fBPigAsZJyyYezNK/LV3T6YTtaFeUEThWGzwh10xR4mLhVwDhdoJ9hNWZANkjLo9J4LGyGAE4Zxg0HOQs/LXd6SW7t5pv5O6na9ELHLFU64PjAzx0oqiPScEb6PdbdJAGwZA4fw6dhJazQnEGXUU6yKGm4tW1azm6zVfBYSf8kFdSUfj+DFsJhk/t29hRTewHNe/jr9JhoIFXzSLSO6sKVL0BfTanO628KQFUpWxU0B9DeblXTaSTUff4AR6nBrIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from SN1NAM02FT044.eop-nam02.prod.protection.outlook.com (10.152.72.54) by SN1NAM02HT129.eop-nam02.prod.protection.outlook.com (10.152.73.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17; Mon, 12 Apr 2021 18:17:59 +0000 Received: from DM6PR06MB5562.namprd06.prod.outlook.com (2a01:111:e400:7e44::44) by SN1NAM02FT044.mail.protection.outlook.com (2a01:111:e400:7e44::173) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Mon, 12 Apr 2021 18:17:59 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:E42E3C71FE3B3A7C828ED3358FC65E561D1ADBC566F4AA94A7271F606761675C; UpperCasedChecksum:171EEB3538D5B5DDE6DF3389AADCFBE18C605D3510994520A9EFA0218C95ACD5; SizeAsReceived:8995; Count:48 Received: from DM6PR06MB5562.namprd06.prod.outlook.com ([fe80::2941:f93d:c31a:2358]) by DM6PR06MB5562.namprd06.prod.outlook.com ([fe80::2941:f93d:c31a:2358%7]) with mapi id 15.20.4020.022; Mon, 12 Apr 2021 18:17:59 +0000 Subject: Re: What is the point of IPC_PRIVATE of shmget? To: Peng Yu Cc: Peng Yu via Libc-help , Florian Weimer References: <87wnt7iizx.fsf@oldenburg.str.redhat.com> <87sg3viio7.fsf@oldenburg.str.redhat.com> From: J Lumby Message-ID: Date: Mon, 12 Apr 2021 14:17:46 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TMN: [00AuUYvrLbfxNCWHlra3ufPxvwELcveY] X-ClientProxiedBy: YTOPR0101CA0006.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:15::19) To DM6PR06MB5562.namprd06.prod.outlook.com (2603:10b6:5:3e::12) X-Microsoft-Original-Message-ID: <77cd8c60-1503-31e4-6bc1-84e962c8bb43@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from macrch.localdomain (69.165.169.141) by YTOPR0101CA0006.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b00:15::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21 via Frontend Transport; Mon, 12 Apr 2021 18:17:58 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: f6acd74a-42b2-4d84-60c4-08d8fddf4d1c X-MS-TrafficTypeDiagnostic: SN1NAM02HT129: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bb1zNpsJ2CGZboMe+l+126ewoTC/K9+scOd2jE/lLAbNHlhF/Q17zkP8v4p72Djt1zR1iegsb/Ixm6HhO+6IwMz+yBauKHRwpk5w0oo7b2sgDpmXsYqE9YWSi1Ix2pDycTmv2k2G6zg3recsqSBWMoW8N04l9Yo+fopkctLKac7BmDEP4uu2/CMlQswSy99WFJd4WC3Asf7Jo1f17SMI1KYJ9UQ/CvnOk1H2IWe7Ud1RhCtGf4ujauWvYNdSnSbyqOsAXXfJnicR9sMSi9ZAbn2Z2bKMosdWcR2IfWm8vf5z7O5Iu03kkti/pBfBqvD/SKNmhIghoxVt7COIxI53k8OfLnES46lBHZkNpDtqsY6N3H0x1UQGbmAVBaIsuGOw5kOGyZqVNxRAG0Vr4BUpRQ== X-MS-Exchange-AntiSpam-MessageData: MKuWfu26JB95Mm/UiqTI+yyBOyAqLmOmBmN2YubOBzVyzpVUx+f00ajD2dvmAXIOPTb7KIF0HBgRY70sdLKfsr36X2B8B4KQCYwCpRnqlFv89rz+eJqbesucyUnYC2WzmXwR/YfEkQy4CNrHQGmwqg== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6acd74a-42b2-4d84-60c4-08d8fddf4d1c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2021 18:17:59.2831 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT044.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM02HT129 X-Spam-Status: No, score=-0.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_MUA_MOZILLA, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2021 18:18:01 -0000 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. >