UNIX Programming and Technical

Q. What is an advantage of executing a process in background?

A. The most common reason to put a process in the background is to allow you to do something else interactively without waiting for the process to complete. At the end of the command you add the special background symbol, &. This symbol tells your shell to execute the given command in the background.
Example: cp *.* ../backup& (cp is for copy)

Read Solution (Total 0)

UNIX Other Question

Q. How would you kill a process?

A. The kill command takes the PID as one argument; this identifies which process to terminate. The PID of a process can be got using 'ps' command
Q. How do you execute one program from within another?

A. The system calls used for low-level process creation are execlp() and execvp(). The execlp call overlays the existing program with the new one , runs that and exits. The original program gets back control only when an error occurs.
execlp(path,file_name,arguments..); //last argument must be NULL
A variant of execlp called execvp is used when the number of arguments is not known in advance.
execvp(path,argument_array); //argument array should be terminated by NULL