Process Simulator Problem

In this post we are going to see a full detailed description about simulation problem of OS work involved in managing processes using Java language.
Problem Statement
Out simulator should simulate the process management in a given aHypothetical Operation System. Input should be read in from a file, and output should be written to a file. The format of the input file will be discussed below.
In the simulation, a Process ID (PID) identifies each process. To achieve this, our program keeps track of the parent of each process, all of the children of each process, and the remaining burst time for the process.
All processes are pre-emptible. That is mean, when any interrupt occurs; the running process is preempted, giving up control of the processor. Its remaining burst time is decrease by 1. When the remaining burst time of a process reaches 0, it terminates and all its children also must be destroyed. Otherwise, the process moves to the appropriate state.
 After the interrupt, the first process on the Ready queue becomes the running process. If there are no processes on the Ready queue, assume that a pseudo-process with PID 0 (e.g. getty() in Unix) runs, but this ``process'' is never put on the Ready queue. (Thus when the simulation first begins, the only thing in the system is the pseudo-process 0, and it is the parent of the first ``real'' process.) Input consists of a series of actions each of which is initiated by an interrupt. All requests come from the preempted process.
Following are the actions or the states that the process could be in:
C <n> <b>
Create a process with PID n with initial burst size b. The parent is the preempted process.
D <n>
Destroy the process with PID n and any children processes that it has. Only the parent of a process or the process itself can destroy a process. Other requests are ignored. You may assume that there will not be any requests to destroyPID 0.
TimerRunOut interrupt. The preempted process must move to the Ready state or terminate, as appropriate.
W <n>
Preempted process has initiated an event with Event ID (EID) n that it must wait for.
E <n>
Event n has taken place. The process waiting for this event moves to the Ready state. Note this action also preempts the current process.
Exit the program. The program should output the current state of the simulation before exiting.


In the next post Process Simulator Solved we are going to discuss the code and you can download it and try it on your own PC.
Facebook Twitter Google+