The OS Simulator provides multithreaded processes and supports multiple CPU simulations. It works with the CPU Simulator and manages multiple processes and virtual memory using different process scheduling mechanisms.
The OS Simulator is designed to support two main aspects of a computer system’s resource management: process management and memory management. Once a compiled code is loaded in CPU Simulator’s memory, its image is also available to the OS Simulator. It is then possible to create multiple instances of the program images as separate processes. The OS Simulator displays the running processes, the ready processes and the waiting processes. Each process is assigned a separate Process Control Block (PCB) that contains information on the process state. This information is displayed in a separate window. The main memory display demonstrates the dynamic nature of page allocations according to the currently selected placement policy. The OS maintains a separate page table for each process which can also be displayed. The simulator demonstrates how data memory is relocated and the page tables are maintained as the pages are moved in and out of the main memory illustrating virtual memory activity.
The process scheduler includes various selectable scheduling policies that include priority-based, pre-emptive and round-robin scheduling with variable time quanta. The OS is able to carry out context-switching which can be visually enhanced by slowing down or suspending the progress at some key stage to enable the students to study the states of CPU registers, stack, cache, pipeline and the PCB contents.
The simulator incorporates an input output console device, incorporating a virtual keyboard, and is used to display text and accept input data.
The OS simulator supports dynamic library simulation which is supported by the appropriate language constructs in the teaching language. The benefits of sharing code between multiple processes are visually demonstrated. There is also a facility to link static libraries demonstrating the differences between the two types of libraries and their benefits and drawbacks.
The simulator allows manual allocation and de-allocation of resources to processes. This facility is used to create and demonstrate process deadlocks associated with resources and enables experimentation with deadlock prevention, detection and resolution.
Threads are fundamental aspects of modern multiprogramming/multi-tasking systems. This feature is supported by the OS Simulator via special language constructs which identify parts of programs for execution as threads. The threads are scheduled like processes but they share their parent’s memory address spaces. The concepts of ‘orphan‘ and ‘zombie’ processes are also explored.
In multiprogramming systems it is sometimes necessary and desirable to prevent multiple processes accessing shared resources at the same time. So the concepts of synchronization and critical regions are facilitated by special teaching language constructs. There is also a Java style subroutine synchronization facility. The CPU utilization can vary depending on the types of applications. The concept of CPU-bound and IO-bound applications can be explored by the OS Simulator by artificially varying the ratio of running to waiting processes. The simulator monitors the CPU and memory utilizations and displays the information in a graphical format at runtime. The concept of CPU load balancing where the burden of high utilisation is shared between processors, can also be explored.
Below are several views of OS Simulator related windows that can be used to observe and monitor the execution of processes. Resource Utilisation view is used to show CPU and memory utilisation. Process List shows the various stats about all processes that the OS is managing. Process Tree is a version of the process list that shows the parent/child relationships of the processes. PCB (Process Control Block) view shows various process attributes that are used when processes are switched between different states. Process States is an animated visual view of the way the processes switch states. Another view of process statistics is the Process Statistics view that display the process waiting times in process queues. The memory usage of processes is visualised in the Main Memory (RAM) view. Here, the placement and replacement of process pages can be observed. Four different system resources are symbolically represented by the System Resources view. As the resources are allocated and deallocated this view shows in colour coded manner. Here, any resource deadlocks are monitored and can be controlled.