Hi Ted,
> pid = fork();
> if (pid == -1)
> err(127, "fork");
> if (!pid) {
> execvp(nargv[0], nargv);
> write(2, "failed to exec\n", 15);
> _exit(127);
> }
> usleep(10);
> while (!waitpid(pid, &status, WNOHANG)) {
> kill(pid, SIGSTOP);
> usleep(onesec / 2);
> kill(pid, SIGCONT);
> usleep(onesec / 10);
> }
> return WEXITSTATUS(status);
The basic idea - only giving part of the system resources to the
maintenance job - looks nice, but even after polishing a few details
and doing some integration, i wonder whether the SIGSTOP/SIGCONT
approach is good enough as the standard solution to be included
in base.
For example, i wonder whether on some fast hardware, 100ms of load
might be sufficient to drain a buffer required to burn a CD/DVD?
Or whether 100ms of load every 500ms might be noticeable on some
hardware when watching a video stream or listening to music?
Admittedly i'm just whining. I have no idea how to implement
real priorities for disk IO. So i shall shut up now.
Yours,
Ingo