It may not be so widely known, but even as (MS-)DOS is intended to be a single-user single-program operating system, one program (process) can spawn another process in several ways. A very handy one is the C-function "system(<program name>)" which simply runs a child process, while the parent process is waiting. As soon as the child completes, the child is removed from memory and control returns to the parent.
So far, everything works fine. Now parents tend to be curious wanting to know what their children do. To achieve this, the parent process hooks into the timer interrupt, installing an interrupt routine which regularly interrupts the child, temporarily returning control back to the parent, performing some work and then switching back to the child. This continues until the child completes its task and permanently returns control back to the parent process. Even this works fine, so far.
Unfortunately there are "nasti" children, child processes that fail to complete, locking-up the whole system by not (permanently) returning control back to their parent process. In such a situation the parent process has to terminate (that sound less cruel than "kill") the child process from within the interrupt routine, as this is the only way for the parent process to do anything, while the child ist still running.
But how can this be done? The apparently obvious way, making a "termiate process" call (of course with the process-ID switched to the child) doen't work satisfacturely. Even though it does terminate the child, it leaves the parent in an unstable condition unsuitable for further operation.
Any ideas what i might be missing?
So far, everything works fine. Now parents tend to be curious wanting to know what their children do. To achieve this, the parent process hooks into the timer interrupt, installing an interrupt routine which regularly interrupts the child, temporarily returning control back to the parent, performing some work and then switching back to the child. This continues until the child completes its task and permanently returns control back to the parent process. Even this works fine, so far.
Unfortunately there are "nasti" children, child processes that fail to complete, locking-up the whole system by not (permanently) returning control back to their parent process. In such a situation the parent process has to terminate (that sound less cruel than "kill") the child process from within the interrupt routine, as this is the only way for the parent process to do anything, while the child ist still running.
But how can this be done? The apparently obvious way, making a "termiate process" call (of course with the process-ID switched to the child) doen't work satisfacturely. Even though it does terminate the child, it leaves the parent in an unstable condition unsuitable for further operation.
Any ideas what i might be missing?