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 8325393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:25:21+00:00 2026-06-09T00:25:21+00:00

I am curious about the behaviour of calling clone from a process with most

  • 0

I am curious about the behaviour of calling clone from a process with most of the flags set (so that the two processes share an execution context, namely share the address space, file descriptor talbe, etc). I wasn’t able to fully answer my question using the material online.

Now assuming I call execve from the cloned process. This replaces the image of the process with a completely new one, destroys attached memory segments, discards allocated memory etc, but what happens to the parent process? Given these share (for example, all the malloced memory regions), do they also get deallocated?

Does the new execved process still share an address space with the parent?

  • 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-09T00:25:23+00:00Added an answer on June 9, 2026 at 12:25 am

    The shared objects are unmapped or unlinked but from a shared perspective.

    Say you have 3 processes/threads all of them sharing memory starting at 0x1000.

    One of them does an execve. Then it will do an shm_unlink(2) on 0x1000.
    shm_unlink(2) will try to unlink(2) it.

    Now for each process/thread using that memory range there is a counter. In our case the counter is set to 3 before the execve(2) and it will be set to 2 after it. No memory loss.

    The memory will be ‘destroyed’, as you put it, when no process is using it anymore. When the counter is 0.

    Same goes for all shared objects. For a list of what system calls are called and how they’re ‘destroying’ the shared objects have a look at the links in the execve(2) manpage. Search for this phrase:

    All process attributes are preserved during an execve(), except the following
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm curious about the correct way to architect an application that consists of the
I am curious about COM+, DCOM. I know that MSFT does not encourage you
I'm curious about the possibility of having a .NET class library that provides a
I am a little curious about the last lines in the two examples presented
Curious about things to consider to avoid any code breaks, etc to upgrade from
I am curious about the liberties that a compiler has when optimizing. Let's limit
I'm curious about this behavior and maybe its just because I've come from using
I'm just curious about this. It strikes me that the behavior of a StringBuilder
Curious about running multiple xvfb displays: I have between 10-50 instances of a script
Being curious about how maven works exactly, I've checked out its source codes. Astonishingly,

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.