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

160
Visualizações
What happens to the child process, when the parent process calls an exec command

Suppose we have a parent process and if it calls an exec function, after calling a fork to create child process.

Now what happens to the child process: will it act like the original parent process, such that the user won't spot the difference that the parent process got replaced with some other binary ?

I think this question differs from the following question what happens to child process?.

if ( (pid == fork ()) != 0 )
{
    if (strcmp(cmd,"mypwd")==0)
    {
        execlp (“mypwd”,0);
    }

    ...
    ...

    else if (strcmp(cmd,"myexit")==0)
        exit(1);
}
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The pid of the parent process will remain the same after the exec, so the process hierarchy won't be affected.

The problem with this approach is that the newly replaced parent process generally won't be aware that it has previously spawned a child and will not call wait or waitpid on it. This will cause the child process to become a zombie when it exits.

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