CS 452/652 Kernel Project

(Part I - Create & Block)


    The main function of a kernel is process management. A process is represented by a process descriptor which contains various types of volatile information---those that are physically shared among processes but otherwise logically distinct. This, in general, includes hardware registers, such as the instruction counter and the i486data segment register. To permit switching the CPU to execute different processes, the kernel needs to select an active process among the ready processes, save its own state, and restore the state of the active process. To create a process the kernel must locate the code for the process, allocate memory for the data and stack, and initialize the stack and process descriptor to allow the process to be switched into.

    In this assignment you will implement the process creation and context switching mechanisms of your kernel. You must provide an implementation of the Create, Pass, Exit, and MyPid primitives as described in the Kernel Specification. These primitives should be implemented using software interrupts as the only method of entering the kernel. Additionally, you must submit an appropriately documented version of your source code, and a report description of your implementation.

    In order to help verify your implementation you must also provide a version of the test system described in pseudo-code below. The system consists of two programs "Init" and "Test". A process running the Init program must be created by the kernel as the first process in the system. This first process then creates several processes running the Test program. The source for your version of this test system should be provided in a separate directory, readable and writable by the course account, along with a makefile which builds a downloadable bindfile from the source.
    Init:
        printf("Starting Process Creation\n");
        for(i = 0; i < 3; i++) {
            Create("Test",PRI0);
            Create("Test",PRI1);
        }
        printf("Finished Process Creation\n");
        Exit();

    Test:
        for(i = 0; i < 3; i++) {
            printf("Executing process %d.\n",MyPid());
            Pass();
        }
        Exit();
PRI0 and PRI1 are process priorities, with PRI0 being higher priority than PRI1. Init should be created at higher priority than PRI0.