I would like to know if there is any good way to execute an external command in Linux environment using C language without using system(), popen(), fork(), exec()?
T
You cannot do this. Linux create new process by sequential call to fork()
and exec()
. No other way of process creation exists.
But fork()
itself is quite efficient. It uses Copy-on-Write for child process, so fork()
not copy memory until it is really needed. So, if you call exec()
right after fork()
your system won't eat too much memory.
UPD. I lie to you saying about process creation. In fact, there is clone()
call which fork()
uses internally. This call provides more control over process creation, but it can be complicated to use. Read man 2 fork
and man 2 clone
for more information.