Re: difference between exec, system, fork, pipe, syscall and eval
by JavaFan (Canon) on Mar 19, 2010 at 15:44 UTC
|
- exec replaces the current process with another one.
- system runs another program, wait for its completion.
- fork copies the current process; both the original and the copy continue from the same point.
- pipe sets up a pipe between two handles.
- syscall makes a low-level system call.
- eval executes (the string form will first compile) a piece of Perl code.
I know these all are system built in function to creating a process.
Uhm, you know wrongly.
| [reply] |
Re: difference between exec, system, fork, pipe, syscall and eval
by ikegami (Patriarch) on Mar 19, 2010 at 15:00 UTC
|
| [reply] |
Re: difference between exec, system, fork, pipe, syscall and eval
by toolic (Bishop) on Mar 19, 2010 at 15:00 UTC
|
| [reply] |
Re: difference between exec, system, fork, pipe, syscall and eval
by kennethk (Abbot) on Mar 19, 2010 at 15:03 UTC
|
The differences between these various elements are detailed in exec, system, fork, pipe, syscall and eval. You've also forgotten backticks, which is the method I need most often. Please note that eval does not invoke the operating system at all, rather invokes the Perl interpreter on the string you pass it. What are you trying to do? | [reply] [d/l] |
Re: difference between exec, system, fork, pipe, syscall and eval
by ssandv (Hermit) on Mar 19, 2010 at 23:01 UTC
|
You also forgot open. And this sounds like homework. It might be helpful if you clarified why this isn't something you can answer yourself with perldoc.
| [reply] [d/l] |
|
|
- exec is used to execute the given process by replacing the
current process.
- If the given process get executed successfully then exec
will not return the value.
- exec returns the value in case of failure only.
- System is also doing the same thing as exec but system returns value in
both success and failure cases.
- And parent process waits for the child process to
complete.
- System() runs the command through a shell,while exec() runs the command
directly.
- fork is used to create a new process(child process).
- And it is returning the PID of child to parent and zero
to child if the fork is successful.
- The difference between the fork and exec is exec replaces the current
process but fork doesn't.
- pipe is used for communicating between two processes.
- We can use both named and nameless pipes.
- It returns open a pair of pipes.
- In one end we can write.
- And in another end we can read the content.
- syscall is used to call the system call which is specified as a first
argument.
- Remaining elements are the arguments to the system call.
For more details visit the following link also.
Perl IPC
| [reply] |