OSLab: Module 3 - Process Management


Overview

Basic process management is introduced in Module 3 of OSLab. Module 3 is combined with the memory management and display tools of Module 2, and the devices of Module 1, producing a simple kernel that can, in theory, support up to 255 processes.

Each process is a set of one or more C functions associated with a unique stack, register state, and a process table. Processes are included in the Module 3 executable file (M3.EXE) at linkage time, and must be registered in function proc_start() in the file MAINLINE.C by calling register_process() with the name of the process's entry point and a process number between 1 and 255. A process is either waiting to run, running, or terminated.

All processes share the common data segment (Intel - DS), but are allocated unique stacks (Intel - SS:SP). Data stored on a process's stack (i.e., local variables) are 'private' to the process. Global data stored in the common data segment can be accessed by any process or the kernel, as can any function (i.e., a function can be called by any other function). However, global data and functions can be 'hidden' at linkage and execution time by prefixing the identifier with the label PRIVATE; this permits the same name to be used in different files.

The same function can be registered repeatedly (as is done in the sample code found in MAINLINE.C). In these cases, each registration causes a new instance of the process associated with the named function; the process shares the code segment (Intel - CS:IP) and data segment, but has a unique stack segment.

When all processes have terminated, the idle process 'kicks in'. The idle process writes a face to the upper righthand corner of the monitor. The supplied version of Module 3 can be terminated using CTRL-ALT-DEL, returning control to DOS or Windows; typing 'X' will cause all processes to terminate and the idle process to start.

Interprocess communication and the reliable sharing of resources is not supported in Module 3.

Support Files

The .H (header) files contain data structures required for this module and the devices. The .C files contain the source code for: