Hi,
Is there something like windows CreateProcess in linux?
The only way to start a process in my program is to use system(); ?
Oh, do not answer to this question please
Any answer is appreciated
Hi,
Is there something like windows CreateProcess in linux?
The only way to start a process in my program is to use system(); ?
Oh, do not answer to this question please
Any answer is appreciated
You might want to look into fork.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Thanks, But As I understood fork() creates a child process with the same memory address.
But I want to start another bin or executable file!!! Run another program?
system()
exec()
popen()
all launch executables.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Yes, But as I know all of this functions invoke a shell to do that?!!!!
Any system call?!
There is no system call without the shell. Indeed, as I mentioned early:
That includes stuff like cd. The shell manages process for init, the parent of all processes.the bash shell is derived from an older unix power tool called "the C shell", and many "system commands" are actually part of the shell -- they do not have their own executables.
Last edited by MK27; 07-26-2009 at 07:03 PM.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
thanks, I got it now
Um, what? My init is /sbin/init, and my shell is /bin/bash -- they are two very separate processes/programs.That includes stuff like cd. The shell manages process for init, the parent of all processes.
To add a bit here -- CreateProcess is the equivalent of a fork() then an exec() of some sort. *nix gives more flexibility in process creation than Windows does.
long time; /* know C? */
Unprecedented performance: Nothing ever ran this slow before.
Any sufficiently advanced bug is indistinguishable from a feature.
Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
The best way to accelerate an IBM is at 9.8 m/s/s.
recursion (re - cur' - zhun) n. 1. (see recursion)
this can be a way. But the forked process name is not the executed application name!!! It's name is the process name that calls fork? Am I right? How to fix this?
Thanks anyone
Something to read:
Delve into UNIX process creation
Picture to look at:
Linux - Process creation
gg
You are right. Another question: If a child process terminate before the parent, after a few time the parent will be a "Zombie" process. And we know that "exec(newProcess)" family system calls, replace (so the child will terminate) the current process with newProcess.CreateProcess is the equivalent of a fork() then an exec() of some sort. *nix gives more flexibility in process creation than Windows does.
If I use a fork and If I use exec in child process, the parent will not be a Zombie process! Why?
Thanks in advance
man waitpid:
Originally Posted by man waitpid
Thanks, But my question is: When I use fork and the exec in child process, the parent will not be "zombie" although the child is terminated. WHY ?
(As you know, If a child terminates before parent, the parent will be "zombie")
Thanks