service dummy restart = 0,023ms
service smb restart = 0,158ms
c application = 0,016ms
After I made this change:
--- /etc/init.d/functions 2010-05-26 13:26:00.000000000 -0300
+++ /etc/init.d/functions 2010-05-26 13:03:01.000000000 -0300
@@ -305,12 +305,13 @@
if checkpid $pid 2>&1; then
# TERM first, then KILL if not dead
kill -TERM $pid >/dev/null 2>&1
- usleep 100000
- if checkpid $pid && sleep 1 &&
+ usleep 1000
+ if checkpid $pid && usleep 100000 &&
+ checkpid $pid && sleep 1 &&
checkpid $pid && sleep $delay &&
checkpid $pid ; then
kill -KILL $pid >/dev/null 2>&1
- usleep 100000
+ usleep 50000
fi
fi
checkpid $pid
After this, the time dropped 60%:
service smb restart = 0,051ms
And finally I wrote this C application:
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
int main(int argc,char *argv[]) {
int pid,ret,a;
for(a=0;a<100;a++) {
if((pid=fork())==0) {
execlp("smbd","smbd","-D",NULL);
exit(-1);
}
waitpid(pid,&ret,0);
kill(pid,9);
}
exit(0);
}
This is the final result:
service dummy restart = 0,023ms
service smb restart = 0,158ms
service smb restart (after hack) = 0,051ms
c application = 0,016ms
We are talking about to gain 0.035ms per process on init using C (service restart) in my notebook.
----
Gustavo Junior Alves
-- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel