CS 452/652 Kernel Project

(Part II - Send / Receive / Reply)


     In this assignment you will extend your kernel by adding the interprocess communication primitives and the remaining process identification primitives. You should provide an implementation for the Send, Receive, Reply, ValidPid, MyParentPid, MyPriority, RegisterAs, and WhoIs primitives as described in the Kernel Specification. The last two primitives listed should be implemented by creating a name server. You must also provide an implementation of the the test system described in pseudo-code below.
    Init:
        Printf("Init --- MyPid = 0x%x\n", MyPid());
        Printf("Init --- MyParentPid = 0x%x\n", MyParentPid());
        Printf("Init --- MyPriority = 0x%x\n", MyPriority());
        tid = Create("Test", PRI0);
        Printf("Init --- Created 0x%x\n", tid);
        i = 6
        Send(tid, &i, lengthof (i), &i, lengthof (i));
        Printf("Init --- Got %d back\n",i);
        Exit();

    Test:
        Printf("Test 0x%x --- MyParentPid = 0x%x\n", MyPid(), MyParentPid());
        Printf("Test 0x%x --- MyPriority = 0x%x\n", MyPid(), MyPriority());
        tid0 = Receive(&i, lengthof (&i));
        Printf("Test 0x%x --- Got %d from 0x%x\n", MyPid(), i, tid0);
        if (i > 1) {
            tid1 = Create("Test", PRI0);
            Printf("Test 0x%x --- Created 0x%x\n", MyPid(), tid1);
            j = i - 1
            Send(tid1, &j, lengthof (j), &j, lengthof(j));
            Printf("Test 0x%x --- Got %d back\n", MyPid(), j);
            i = i*j
            Reply(tid0, &i, lengthof (i));
        } else
            Reply(tid0, &i, lengthof (i));
        Exit();

    The system recursively calculates 6! (720) using process creation and Send/Receive/Reply. The kernel should create a process running the program Init as the first process in the system.

    You must submit a documented copy of the source code for both your kernel and the test system, along with a brief description of your implementation. You must also provide a downloadable file which can be used to run the above test with your kernel.