Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

179
Visualizações
Memory mirroring for a ring buffer on Linux

I use an anonymous mmap to allocate a giant chunk of memory. There are several contiguous pages in this that I'd like to turn into a ring buffer, using virtual memory mirroring.

This example on Wikipedia shows what I'm meaning by virtual memory mirroring.

Say the first 14 blocks below are the pages in my giant chunk. I'd like to virtually map pages 6 and 7 to another two consecutive locations.

[0][1][2][3][4][5][6][7][8][9][10][11][12][13].......[6][7][6][7]

Mike Ash gives a rundown of what I want to do, but using mach specific APIs.

How can this be done on Linux?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

This is not possible to achieve with anonymous mappings. You can, however, use memfd_create(2) or create a temporary file on tmpfs (so that it won't ever be stored to disk, except by "swapping") and do shared mappings on that file descriptor, adjacent to each other.

remap_file_pages(2) is just a performance hack and not any more powerful than classic mmap/mremap calls, and it can't operate on anonymous mappings either.

Related: Linux mremap without freeing the old mapping?

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda