Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7804787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:02:25+00:00 2026-06-02T02:02:25+00:00

Is it possible to share executable pages on Linux for the sake of preserving

  • 0

Is it possible to share executable pages on Linux for the sake of preserving space? I know that there are shared memory APIs that can be used to share memory between different processes but I don’t think that is meant to be used for that.

Basically, I want to have a shared memory region where some commonly used shared libraries can be loaded into. I want to get the dynamic linker to link against the preloaded (read only) images instead of having to load all of the shared library images into every single process (which seems like a waste).

Is this possible on the Linux kernel? The Darwin kernel implements this using a feature of Mach VM known as commpages (the dyld shared cache is stored there). The commpages are accesible to and shared between every process.

Just to clarify, I know what shared objects (libraries) are. Currently, what the dynamic linker does on Linux is it loads all the required libraries into the program’s address space, which means that each application that links against libc (for example) will have an image of libc somewhere in its address space. On Darwin, this issue can be eliminated by having the executable (and other read only) sections of libc on a set of shared memory pages. The writable sections of the shared images are still separate.

Edit: I know that the ELF format does not support separating DATA and TEXT segments of the shared libraries. I’m not using ELF, I’m using a different binary format (with my own binfmt kernel module and my own dynamic linker). I’m interested if the Linux kernel supports a commpage-like feature.

Edit 2: The only way I can think of doing this would be to allocate a big slab of memory in the kernel and map it into every binary that gets executed. The first time any binary is executed, the dynamic linker could unprotect it, fill it with the desired data and protect it. Then somehow, the kernel would have to make sure that the memory segment is not modified by anything else as it would open a massive security hole. Another

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:02:26+00:00Added an answer on June 2, 2026 at 2:02 am

    As geekosaur said, Linux already does this.

    At application startup the dynamic linker (ld.so) mmap()s the shared libraries.
    It performs several calls to mmap() for each library:

    • mmap(PROT_READ|PROT_EXEC) for the executable section (i.e. .text)
    • mmap(PROT_READ|PROT_WRITE) for the data (i.e. .data and .bss)

    (You can check this for yourself using strace.)

    The kernel, being a clever little bit of code, realises that the executable section, identified by offset and the inode (known through the fd), is already mapped. As it’s read-only there’s no point in allocating more memory for it.

    This also means that if you have any other file which you mmap() read-only from several application the memory will also be consumed only once.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read in several places that it's possible to share the objects directory
Is it possible in jdom to get the children of a node that share
Can anyone share simple sample of using Semaphore? If it's possible a sample of
Is it possible to pack an executable into a shared library and upon calling
I'd like to know if it is possible to share grid contents across different
Is it possible to share resources across APK's? For example, can application A (in
Possible Duplicate: Can you share a file and it's history between two git repositories?
Is it possible to share references to C# objects between C# and C++ code
In MS SQL is it possible to share an identity seed across tables? For
I created a repository with TortoiseHg. Is it possible to share it with other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.