DOS and Multitasking
MS-DOS access provides a good example of the need to keep activities at a particular level. Generating all DOS calls in the background task will prevent any inadvertent research into MS-DOS reentrancy.
While there is an indos flag that can permit DOS to have some reentrancy, for the purpose of this article it is best to assume DOS has none. Refer to books and articles about "terminate and stay resident" programs for details.
Many standard library functions also have error calls to MS-DOS in routines that do not normally access MS-DOS. Even floating-point operations can generate exceptions such as divide by zero. In real-time applications it is usually best to prevent the program from encountering fault conditions, where possible.