0

The regular shell allows a user to run a process in the background by ending the command with an &. I was asked to write a C program to do a similar job above. How can i write a background process ? Many Thanks !!

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by dkalita
2

use fork() to create a child process and in the child process use execv() to call the background process.
read about fork() and execv() and their usage.

it looks like

int child;
child=fork();

if(child==0)
{
      execv(............);
}
else
{
        /*current process*/
}

Edited by dkalita: n/a

Votes + Comments
Excellent!
Good answer :)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.