Linux: why to execute a program first we need to copy current one?What's the difference between eval and...

What is the point of impeaching Trump?

How to level a picture frame hung on a single nail?

Is there a way to double indent equations

What powers or limits devil promotion?

Is there an in-universe explanation of how Frodo's arrival in Valinor was recorded in the Red Book?

Query to get counts of values per column

What action is recommended if your accommodation refuses to let you leave without paying additional fees?

Search for something difficult to count/estimate

Why is there such a singular place for bird watching?

Found a minor bug, affecting 1% of users. What should QA do?

Bothered by watching coworkers slacking off

Isn't the detector always measuring, and thus always collapsing the state?

Realistically, how much do you need to start investing?

Using 4K Skyrim Textures when running 1920 x 1080 display resolution?

How dangerous are my worn rims?

Looking for circuit board material that can be dissolved

Would a horse be sufficient buffer to prevent injury when falling from a great height?

How to "Start as close to the end as possible", and why to do so?

Could Boris Johnson face criminal charges for illegally proroguing Parliament?

Present participles of the verb esse

Bwv 639 Bach/Busoni note length and symbols

Why do many websites hide input when entering a OTP

Does the 'java' command compile Java programs?

Does it require less energy to reach the Sun from Pluto's orbit than from Earth's orbit?



Linux: why to execute a program first we need to copy current one?


What's the difference between eval and exec?Why do we need to fork to create new processes?Why is the default process creation mechanism fork?How does copy-on-write in fork() handle multiple fork?closing the unwanted file descriptorsSIGINFO on GNU Linux (Arch Linux) missingPerformance of calling POSIX-specified functions versus direct Linux kernel callsvfork() calls SYS_vfork but fork() calls SYS_clone?Difference Between bg and kill -CONTWhat happens to the old stack, heap, and (initialized and uninitialized) data segments after execve() call?Is there any difference to run a process in the background with an & vs when it has --daemonize option?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}








0















Seems to me it is so general question I wanted to ask on Computer Science site but could not find proper tags, so asking here. Mods please move if appropriate.



As I've read in many places, e.g. here What's the difference between eval and exec? to run a program parent process in Linux forks (copies all info) itself then replaces in that fork itself by calling exec with needed program.



Why not just make/start a new process? How is it better (as it was implemented that way, looks like it is better by some criteria)?



I could not find an answer by web search for Linux: why to execute a program first we need to copy (fork) current one? and here on SE questions on exec fork are about technical details, not why type.










share|improve this question

























  • I've read on one Q&A long ago that this was done for efficiency. Starting new process at the time of the first Unix was expensive in terms of resources, RAM and CPU cycles. Cloning and replacing process via exec was easier. Of course nowadays it's not necessary on regular desktop or server but on something embedded like router or Raspberry Pi that still helps. So you could say historical reasons is one reason

    – Sergiy Kolodyazhnyy
    10 mins ago











  • Let me know if you dont get a good answer. I'll try to look up that Q&A I mentioned in my previous comment.

    – Sergiy Kolodyazhnyy
    9 mins ago






  • 1





    I think it's this one unix.stackexchange.com/q/136637/85039 Maybe even fits as duplicate

    – Sergiy Kolodyazhnyy
    7 mins ago











  • @Sergiy Kolodyazhnyy, thank you, looks like duplicate, I don't see in my GUI way to mark it as one.

    – Marisha
    5 mins ago











  • Possible duplicate of Why do we need to fork to create new processes?

    – Sergiy Kolodyazhnyy
    3 mins ago


















0















Seems to me it is so general question I wanted to ask on Computer Science site but could not find proper tags, so asking here. Mods please move if appropriate.



As I've read in many places, e.g. here What's the difference between eval and exec? to run a program parent process in Linux forks (copies all info) itself then replaces in that fork itself by calling exec with needed program.



Why not just make/start a new process? How is it better (as it was implemented that way, looks like it is better by some criteria)?



I could not find an answer by web search for Linux: why to execute a program first we need to copy (fork) current one? and here on SE questions on exec fork are about technical details, not why type.










share|improve this question

























  • I've read on one Q&A long ago that this was done for efficiency. Starting new process at the time of the first Unix was expensive in terms of resources, RAM and CPU cycles. Cloning and replacing process via exec was easier. Of course nowadays it's not necessary on regular desktop or server but on something embedded like router or Raspberry Pi that still helps. So you could say historical reasons is one reason

    – Sergiy Kolodyazhnyy
    10 mins ago











  • Let me know if you dont get a good answer. I'll try to look up that Q&A I mentioned in my previous comment.

    – Sergiy Kolodyazhnyy
    9 mins ago






  • 1





    I think it's this one unix.stackexchange.com/q/136637/85039 Maybe even fits as duplicate

    – Sergiy Kolodyazhnyy
    7 mins ago











  • @Sergiy Kolodyazhnyy, thank you, looks like duplicate, I don't see in my GUI way to mark it as one.

    – Marisha
    5 mins ago











  • Possible duplicate of Why do we need to fork to create new processes?

    – Sergiy Kolodyazhnyy
    3 mins ago














0












0








0








Seems to me it is so general question I wanted to ask on Computer Science site but could not find proper tags, so asking here. Mods please move if appropriate.



As I've read in many places, e.g. here What's the difference between eval and exec? to run a program parent process in Linux forks (copies all info) itself then replaces in that fork itself by calling exec with needed program.



Why not just make/start a new process? How is it better (as it was implemented that way, looks like it is better by some criteria)?



I could not find an answer by web search for Linux: why to execute a program first we need to copy (fork) current one? and here on SE questions on exec fork are about technical details, not why type.










share|improve this question














Seems to me it is so general question I wanted to ask on Computer Science site but could not find proper tags, so asking here. Mods please move if appropriate.



As I've read in many places, e.g. here What's the difference between eval and exec? to run a program parent process in Linux forks (copies all info) itself then replaces in that fork itself by calling exec with needed program.



Why not just make/start a new process? How is it better (as it was implemented that way, looks like it is better by some criteria)?



I could not find an answer by web search for Linux: why to execute a program first we need to copy (fork) current one? and here on SE questions on exec fork are about technical details, not why type.







linux exec






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 19 mins ago









MarishaMarisha

305 bronze badges




305 bronze badges
















  • I've read on one Q&A long ago that this was done for efficiency. Starting new process at the time of the first Unix was expensive in terms of resources, RAM and CPU cycles. Cloning and replacing process via exec was easier. Of course nowadays it's not necessary on regular desktop or server but on something embedded like router or Raspberry Pi that still helps. So you could say historical reasons is one reason

    – Sergiy Kolodyazhnyy
    10 mins ago











  • Let me know if you dont get a good answer. I'll try to look up that Q&A I mentioned in my previous comment.

    – Sergiy Kolodyazhnyy
    9 mins ago






  • 1





    I think it's this one unix.stackexchange.com/q/136637/85039 Maybe even fits as duplicate

    – Sergiy Kolodyazhnyy
    7 mins ago











  • @Sergiy Kolodyazhnyy, thank you, looks like duplicate, I don't see in my GUI way to mark it as one.

    – Marisha
    5 mins ago











  • Possible duplicate of Why do we need to fork to create new processes?

    – Sergiy Kolodyazhnyy
    3 mins ago



















  • I've read on one Q&A long ago that this was done for efficiency. Starting new process at the time of the first Unix was expensive in terms of resources, RAM and CPU cycles. Cloning and replacing process via exec was easier. Of course nowadays it's not necessary on regular desktop or server but on something embedded like router or Raspberry Pi that still helps. So you could say historical reasons is one reason

    – Sergiy Kolodyazhnyy
    10 mins ago











  • Let me know if you dont get a good answer. I'll try to look up that Q&A I mentioned in my previous comment.

    – Sergiy Kolodyazhnyy
    9 mins ago






  • 1





    I think it's this one unix.stackexchange.com/q/136637/85039 Maybe even fits as duplicate

    – Sergiy Kolodyazhnyy
    7 mins ago











  • @Sergiy Kolodyazhnyy, thank you, looks like duplicate, I don't see in my GUI way to mark it as one.

    – Marisha
    5 mins ago











  • Possible duplicate of Why do we need to fork to create new processes?

    – Sergiy Kolodyazhnyy
    3 mins ago

















I've read on one Q&A long ago that this was done for efficiency. Starting new process at the time of the first Unix was expensive in terms of resources, RAM and CPU cycles. Cloning and replacing process via exec was easier. Of course nowadays it's not necessary on regular desktop or server but on something embedded like router or Raspberry Pi that still helps. So you could say historical reasons is one reason

– Sergiy Kolodyazhnyy
10 mins ago





I've read on one Q&A long ago that this was done for efficiency. Starting new process at the time of the first Unix was expensive in terms of resources, RAM and CPU cycles. Cloning and replacing process via exec was easier. Of course nowadays it's not necessary on regular desktop or server but on something embedded like router or Raspberry Pi that still helps. So you could say historical reasons is one reason

– Sergiy Kolodyazhnyy
10 mins ago













Let me know if you dont get a good answer. I'll try to look up that Q&A I mentioned in my previous comment.

– Sergiy Kolodyazhnyy
9 mins ago





Let me know if you dont get a good answer. I'll try to look up that Q&A I mentioned in my previous comment.

– Sergiy Kolodyazhnyy
9 mins ago




1




1





I think it's this one unix.stackexchange.com/q/136637/85039 Maybe even fits as duplicate

– Sergiy Kolodyazhnyy
7 mins ago





I think it's this one unix.stackexchange.com/q/136637/85039 Maybe even fits as duplicate

– Sergiy Kolodyazhnyy
7 mins ago













@Sergiy Kolodyazhnyy, thank you, looks like duplicate, I don't see in my GUI way to mark it as one.

– Marisha
5 mins ago





@Sergiy Kolodyazhnyy, thank you, looks like duplicate, I don't see in my GUI way to mark it as one.

– Marisha
5 mins ago













Possible duplicate of Why do we need to fork to create new processes?

– Sergiy Kolodyazhnyy
3 mins ago





Possible duplicate of Why do we need to fork to create new processes?

– Sergiy Kolodyazhnyy
3 mins ago










0






active

oldest

votes













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});















draft saved

draft discarded
















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f543978%2flinux-why-to-execute-a-program-first-we-need-to-copy-current-one%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

















draft saved

draft discarded



















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f543978%2flinux-why-to-execute-a-program-first-we-need-to-copy-current-one%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...