Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.system > #811

Re: Linux/C/mmap(): Avoiding the flushing of memory mapped region created using mmap to the underlying file

Newsgroups comp.os.linux.development.system
Date 2023-03-09 04:10 -0800
References <f6078236-3464-4bb9-a6ce-f5e844ff6ca8n@googlegroups.com> <wwvttyx94py.fsf@LkoBDZeT.terraraq.uk> <08b28d33-27dd-4074-af1d-b816849d4a50n@googlegroups.com> <wwvr0tzeiab.fsf@LkoBDZeT.terraraq.uk>
Message-ID <447392c3-448f-4c5b-be9d-d89e5bdec2a7n@googlegroups.com> (permalink)
Subject Re: Linux/C/mmap(): Avoiding the flushing of memory mapped region created using mmap to the underlying file
From Pavankumar S V <pavankumarsv96@gmail.com>

Show all headers | View raw


On Wednesday, 8 March 2023 at 14:23:03 UTC+5:30, Richard Kettlewell wrote:
> Pavankumar S V <pavanku...@gmail.com> writes: 

> That has a time-of-check/time-of-use bug even on a single core, and 
> there’s no chance it’ll work across multiple cores due to the lack of 
> memory synchronization.

Ok understood. I was trying to use shared memory concept to achieve explicit synchronization (as Shared memory is the fastest way of IPC). I think intention of shared memory concept is just to transfer some data from one process to another quickly. We cannot use Shared memory concept for synchronization purpose. Because, even though shared memory is very fast, data written by one process will not be visible to another immediately. Is my understanding right?

> By synchronization mechanism I mean something like fctnl with F_SETLK, 
> or pthread_mutex_lock (with a mutex initialized with 
> PTHREAD_PROCESS_SHARED). 

ok. I'll try pthread_mutex_lock or semaphores to achieve the synchronization.

Thank you very much.

> -- 
> https://www.greenend.org.uk/rjk/

Back to comp.os.linux.development.system | Previous | NextPrevious in thread | Find similar


Thread

Linux/C/mmap(): Avoiding the flushing of memory mapped region created using mmap to the underlying file Pavankumar S V <pavankumarsv96@gmail.com> - 2023-03-04 23:37 -0800
  Re: Linux/C/mmap(): Avoiding the flushing of memory mapped region created using mmap to the underlying file Richard Kettlewell <invalid@invalid.invalid> - 2023-03-06 17:20 +0000
    Re: Linux/C/mmap(): Avoiding the flushing of memory mapped region created using mmap to the underlying file Pavankumar S V <pavankumarsv96@gmail.com> - 2023-03-07 22:31 -0800
      Re: Linux/C/mmap(): Avoiding the flushing of memory mapped region created using mmap to the underlying file Richard Kettlewell <invalid@invalid.invalid> - 2023-03-08 08:53 +0000
        Re: Linux/C/mmap(): Avoiding the flushing of memory mapped region created using mmap to the underlying file Pavankumar S V <pavankumarsv96@gmail.com> - 2023-03-09 04:10 -0800

csiph-web