![]() | ![]() |
|
||||||||||||||||||||||||||||||
|
User ProcessesUser processes are implemented by Java threads. Each user process is represented by the class Application in Figure 1. Part of the class structure in the diagram is considered as "kernel space". The classes labeled Process, Application and SysLib are "user space", although Process is defined in the kernel package.
Figure: User Processes Although a user process runs in a thread, it is not derived from Thread but contained, rather, as a field in ProcessWrapper, which is derived from Thread. The reason for this separation is to hide the PCB from the process. The PCB is required by startup code in ProcessWrapper to establish the constraint that only one process is active at a time. That is, the startup code in ProcessWrapper executes, as it were, on the kernel side. In the code below, the run() method of ProcessWrapper begins by blocking on its own PCB.
A user process is any class derived from kernel.Process. For example, here is the code for HelloWorld.
User processes must have access to the interrupt mechanism in order to make system calls. This is done by calling one of the convenience methods SVC, visible through inheritance. Each SVC method prepares parameters in the kparam array of Process, invokes the interrupter and returns the result of the system call. SysLib puts wrappers around system calls to strongly type the arguments and result. This is explained in the section Kernel Calls.
|
|||||||||||||||||||||||||||||
Last update 01/24/05
Copyright © Gerald Dueck
[=]