OS Sim (Operating Systems Concepts Simulator) is an
educational purpose application to graphically simulate Operating
System concepts and support the computer science students learning process.
Specifically, the application is divided into four blocks or independent
simulations: process scheduling, memory management, file system
management and disk scheduling policies.
Beyond trying to describe complex real systems, it focuses on the
fundamental Operating Systems concepts as they are explained to computer
science students, including the main algorithms and their most relevant
parameters.
It also has a number of examples and exercises with the corresponding
simulations to be able to explore all application potential.
The current application version is 1.2.
It is freely available for any use under the BSD license.
The Welcome screen allows direct access to each of the simulations, later it is possible to come back from File menu.
|
Process Scheduling |
Memory management |
|
File System |
Disk Scheduling |
Most menu actions are available through the keyboard shortcuts shown below:
|
Action |
Shortcut |
|
Exit |
CTRL + E |
|
Open a saved simulation |
CTRL + O |
|
Save a simulation |
CTRL + S |
|
Open process scheduling |
CTRL + P |
|
Open memory management |
CTRL + M |
|
Open file system management |
CTRL + I |
|
Open disk scheduling policies |
CTRL + D |
|
Help |
F1 |
|
About ... |
CTRL + A |
At the moment the application is available in three languages:
English.
Catalan.
SpanishThe simulation focuses on short-term processes scheduling
with a single processor, its objective is to select one of the available
processes to run on the processor.
A process execution involves alternating cycles of CPU and I/O bursts
(CPU and I/O Burst Cycle). A process is available only during a CPU
bursts.
The simulation is based on the three-state model, which defines three
process states and its possible transitions: Running, Waiting (or Ready)
and Blocked.

At any moment only one process is running, other processes are waiting in the ready queue until the scheduler selects them, or are blocked doing I/O operations.
Scheduler decisions depend mainly on two factors: the scheduling
algorithm and multiprogramming. The user can choose four different
algorithms: FCFS (First Come First Served), SJF (Shortest Job
First), Priority and Round Robin, and may also indicate if you want a
monoprogramming or multiprogramming system.
Scheduling algorithms differ in how they select the next processes to
execute:
Round Robin. This algorithm was designed especially for time-sharing systems, a unit of time called quantum limits the time that processes can run every time they enter the processor, when quantum timeout processes queue up again.
Preemptive algorithms: running processes can be forced to leave the processor to another more privileged process before completion. Otherwise the algorithms are not preemptive or cooperative.
Further information
http://en.wikipedia.org/wiki/Scheduling_
(computing)
http://en.wikipedia.org/wiki/Computer_multitasking

Can be idle (free) or busy, in this case it shows the running
process, its relevant information (PID, name, priority) and the complete
life cycle (CPU and I/O bursts).
Each box of the burst cycle corresponds to a simulation time unit, in red it
shows where in cycle is the process.
The running process leaves the processor when finish, returns to the
ready queue or start an I/O burst.
Contains the processes available to execute (waiting).
The queue is always ordered depending on the scheduling algorithm (first
right, last one left):
For each process it shows the most relevant information (PID,
name, priority) and the complete life cycle (CPU and I/O bursts).
Each box of the burst cycle corresponds to a unit of simulation time, in red
it shows where in cycle is the process.
While the simulation is stopped, right-click on any process to display popup
menu that lets you modify and delete the process.
Processes only leave the ready queue to come into the processor.
Criteria in the entry order of processes in the queue after starting the simulation: new processes (incoming) -> processes that complete I/O -> processes that leave the CPU
Processes that start later (time start > 0) are placed in this
queue. As the simulation progresses and the time comes to start, they enter
the ready queue.
This queue allows the user to plan the whole simulation and then run it
completely without further intervention.
Processes are sorted by remaining time to start, (or remaining time to
enter the ready queue).
While the simulation is stopped, selecting any process from the table shows a popup menu that lets you modify and delete the process.
Sets simulation behaviour:
Round Robin: It is always preemptive, the quantum is the maximum time a process can run continuously. Possible values: 1 to 10 time units.
Processes can only be added while the simulation is stopped, for each new process enter the following information:
Burst cycle, the table allows you to specify the duration of CPU and I/O bursts, each row is a time unit, all processes necessarily start with a CPU burst besides if complete, the last burst must also be a CPU. Maximum process duration is 10 time units.
Settings are only available while the simulation is stopped
See resulting scheduling information at any time of the simulation.
Aggregate data are:
For each process there is a table with the following information
The simulation shows the load of processes in main memory according to different memory management systems. In addition it offers simplified versions of swapping and virtual memory behaviours.
The memory management algorithms are divided into two groups:

Includes two possible management algorithms:
Variable-sized partitions, the memory at the beginning is all available, for each process partition exactly the size of this is created, as the process is complete, the partitions are released and can be reused. Released partitions generate external fragmentation.
Another concept of interest is the allocation policy, how the operating system selects one of the available partitions, application provides the most common:



The processes are allocated into main memory, either whole or
divided in pages or segments.
By definition in any of the memory management systems, there is always a
first process loaded, occupying the base addresses, the Operating
System, the size of which can vary between 1, 2 or 4 units.
Addresses, processes, partitions available or allocated are always shown,
also, fragmentation following a color code that allows a quick
understanding of it state.
|
Colors: |
Meaning |
|
gray |
Operating System |
|
white |
Unpartitioned memory |
|
blue dots |
Internal fragmentation |
|
pink dots |
External fragmentation |
|
[Other colors] |
Processes, their own color |
The memory size of the simulation varies between 64 and 256 units.
Right click on memory to display the pop up menu that lets you perform various actions:
During simulation time and for each allocated process into memory, delete the process, swap out, open address translation, see its detailed information (only pagination and segmentation) and defragment memory (only for partitions of variable size and segmentation) .
Contains the processes available to be allocated into memory ordered by their arrival to the queue.
For each process it shows the most relevant information (PID,
name and duration that may be infinite), besides the size and its
distribution, where each box corresponds to one unit of space, which is
allocated to a single memory address.
In pagination and segmentation the process differentiates components, pages,
or segments, and highlight in gray the ones that are not initially
allocated into memory but directly to swap.
While the simulation is stopped, right click on any process to display a
pop up menu that lets you update and delete.
Sets simulation behaviour:
Any change of algorithm, memory size or OS size requires restarting the simulation and deletes all existing processes.
Processes can only be added while the simulation is stopped, for each new process enter the following information:
Color, color that will draw the graphic elements associated with the process.
Addition in pagination is shown:
And in segmentation is shown:
Shows memory allocation information at any simulation time. This information varies from one algorithm to another.
Contiguous memory management, table with the following information
(If the partition contains a process)
Duration of the process.
In pagination, a table with the following information is shown
(If the partition is busy)
Duration of the process.
In segmentation, is a table with the following information
(If the partition contains a process)
Duration of the process.
Shows memory allocation information of a process in non contiguous memory management.
In pagination, table's content is
In segmentation, table's content is
Simply indicate starting address and partition size .
Partitions can not overlap, nor can they terminate beyond the end of memory.
Variable-sized partitions and segmentation have in common that partitions are created dynamically and are sized to accommodate exactly these processes or segments, therefore Operating System selects a greater or equal partition and generally divide it into two parts, in one we allocate the process or segment and the other remains available.
Once released (because the process is complete or has been swapped out), it is newly available and so on, the available partitions become smaller and the memory is degraded.
Defragmantation process solves it reorganizing the memory, comprises all the processes in the lower areas of memory and then creates a partition as big as all the available memory.
This is an OS responsibility, it is left to the user in the simulation (pop up menu from memory).
Swapping (or backing store) allow running more processes than can fit in main memory and is usually implemented in secondary memory.
The idea is based on having an extra space where to move processes or parts of them (pages or segments) less active and reallocate them when necessary.
Simulation simplifies this, delegating swap in and out between memory and swap to the user manually.
Swap out from memory's pop up menu(right click on memory). Swaps out a process or a part of this.
Swap in, from memory's pop up menu(right click on memory). Try to swap in a process or part of it to memory, if the memory is full it generates an error and does not swap in.
The pagination and segmentation algorithms allow to initially swap out pages or segments. This area is not limited on the amount or size of the processes it contains.
The file system manages the relationship between the logical space as the user sees (files, directories, links) with the corresponding structure and physical location (real) objects in secondary memory.
The minimum work unit of file system is the block, memory and file system objects are divided into blocks of the same size, and the system management is to allocate those object blocks into available blocks of secondary memory and to maintain the control.
The simulation implements the two main techniques for File System Management:
Indexed allocation with three levels of indirection (UNIX systems).
The simulation parameters are:
The first 128 disk blocks are not used to simulate the OS administrative tasks and are not used.
The two File System Management algorithms are:
The single indirect block points to data blocks, double indirect block
point to blocks which in turn point to data blocks and triple indirect
blocks point to blocks that point to block that point to data blocks.
To create new files first i-node data blocks are used, then the single
indirect , double and triple blocks to fill the information required
depending on the file size. For simplicity folders occupy a block (of
data), and links none. 
Reference http://es.wikipedia.org/wiki/Inodo
In the simulation the maximum number of i-nodes that can be created are 128, indirect blocks have 20 pointers. In the table below shows how to calculate the blocks needed to create a file.
|
Available Data blocks |
Administration Blocks |
Total data Blocks |
|
Total Blocks |
|
|
One i-node |
12 blocks |
Head |
12 |
0 |
12 |
|
First |
Past more ... |
1 indirect block |
32 |
1 |
33 |
|
Second |
Past more ... |
1 indirect block |
432 |
22 |
454 |
|
Third |
Past more ... |
1 indirect block |
8.432 |
433 |
8.875 |

Displays the file system as seen by users, the folder tree, and files, links and subfolders within each folder. The (root) depends on the file system manager, UNIX is "/" MD-DOS is "C:\".
Right click on any object to display the pop up menu that lets you perform various actions:
Remove the object.
Shows the device (physical file system) divided into blocks, and at its right disk addresses.
The initial addresses (128 units) are reserved for OS administration tasks and are not used.
The blocks are painted in different colors depending on its type:
|
Colors: |
Block use |
|
black |
Administration (File System) |
|
white |
Available |
|
Green |
Folder |
|
Blue |
Soft link |
|
[Other colors] |
Occupied by a file |
This view depends on the selected folder logical file system displays the contents of this folder, each object is drawn with the corresponding color: file (file varies according to color), links (blue), folders (green).
For any object it indicates its reference to the physical file system . For UNIX object's i-node, for MS-DOS initial entry in the FAT table.
Right click on any file system object to display a pop up menu that allows you to view the object's detailed information .
Sets the simulation's behaviour:
Indexed allocation with triple indirection (UNIX).
Any change of algorithm, block size or memory size requires restarting the simulation and deletes all existing objects.
The file is added to the folder that is currently selected, for each new file you must enter the following information:
Color, color that will draw the graphic elements associated with the file.
The folder is added to the folder that is currently selected,
It is only necessary to indicate the new folder's name (required).
The link is added to the folder that is currently selected for each new link it is necessary to enter the following information:
Target, link target.
From the folder view, user can open detailed information of any object within the folder, this information depends on the file system.
UNIX shows i-node structure:
Type: "block" if data or "indirection" if it is indirect.
For MS-DOS displays the FAT table entries for the object:
Next object's block number or "nil" if last.
Shows the device's information. This information varies from one algorithm to another.
In UNIX, shows a table with all device data blocks, for each block:
In MS-DOS, shows the FAT table, that is a snapshot of all the device's blocks, each table entry contains the following information:
It is the disk scheduling policies within Operating System I/O devices management.
Despite their heterogeneity, optical or magnetic disk, rigid or flexible, read-only or read / write CD, DVD's or HHD for example, the whole can be treated similarly.
Disks are organized in sectors, they are grouped into tracks, the tracks are on one side or surface on a platter, and each disk can have several platters.

Reference http://es.wikipedia.org/wiki/Disco_duro
The set of tracks that are in the same head position are called cylinders. The platters rotate constantly and each one has one head just above, that reads and writes sectors, heads move perpendicular to the tracks.
Disk sectors are referenced sequentially, the first sector is 0, and it is in the first track of the first platter in the outer cylinder.
In the simulation disk geometry is: a platter, 16 cylinders, 12 sectors per cylinder, totally 192 sectors or data blocks.
The Operating System constantly receives requests to write and read from disk, how to serve these requests is defined by the disk scheduling policy.
A good scheduling policy should minimize head movement, which means a longer life for the device, and requests-to-response time.
In the simulation there are available the following scheduling policies:
FIFO. Fist In First Out This scheduling is quite simple, serves requests in strict order of arrival. The head moves always looking for the next request wherever it is, do not try to minimize head movement but it's correct because it does not prioritize any request.
LIFO. Last In First Out unlike FIFO, serves requests in the reverse order of arrival, the last came first served. The latest requests are served immediately, but may cause starvation, the first requests will never be served if new ones are arriving constantly.
STF. Shortest (Seek) First Time always serves first closest request to head's position. Such scheduling minimizes head movement, but can also cause starvation.
SCAN. Also called "Elevator", head moves from the outermost cylinder to the innermost when it reaches the end it changes direction and returns to the beginning, and so on indefinitely. Handle requests when they turn up during its movement.
C-SCAN. Circular SCAN. Same as SCAN, the difference is that when it reaches the inner cylinder at the disk end's, it moves directly to the beginning and starts again, so always handle requests in the same direction. Improving one of the SCAN drawbacks, which goes over track that have just been seen when it changes direction.
LOOK. Is a variation that improves SCAN scheduling, the difference is that it only goes up to the last request and not until the last cylinder. At the moment it detects that there are no more requests forward, then it changes direction.
C-LOOK.Circular LOOK. Includes both LOOK and C-SCAN improvements only go up to the last request and also when it reaches the outer, moves to the first one and starts again, it always serves requests in the same direction.

Shows sectors and cylinders disk divisions.
The sector 0 (first) is at outermost cylinder, above and right of vertical.
At any simulation time head position is shown in black, and requests in the corresponding color
While the simulation is stopped, right-click on any request to display a pop up menu that allows you to modify and delete.
The graph represents head motion through cylinders as the requests are served.
In the x-axis cylinders and ordinate the time.
Each served request is marked with a dot (appropriate color) indicating the cylinder where the sector is served and the time, points are joined with lines that represent head movement through the cylinder.
View all the requests, the information in the table is as follows:
Requests can be in three different states:
Served are shown first, then those that are waiting and finally those that have not yet arrived.
While the simulation is stopped, right-click on any request to display a pop up menu that allows you to modify and delete.
Sets simulation behaviour:
Settings are only available while simulation is stopped
Requests can be added only while the simulation is stopped, for each new request must enter the following information:
Additionally, the system calculates and shows cylinder that corresponds with requested sector.
While the simulation is stopped, users can save their simulations and open them later to complete, review, etc ...
Saves all simulation objects and settings.
It is not possible to open nor save simulations while running OS Sim as an Applet has some limitations due to java security issues.
To manage simulation progress, normal run, step by step (a unit of time each step), stop and restart the simulation.
Additionally you can vary speed rate from 0.5 seconds to 2 seconds per unit time.
Simulation time is always shown.
| Content | ||
|
Simple FIFO scheduling example |
||
|
SJF scheduling non preemptive |
||
|
Priority scheduling preemptive |
||
|
Round Robin scheduling (quantum: 2) |
||
|
Multiprogramming I/O |
||
|
Monoprogramming I/O |
||
| Content | ||
|
Contiguous memory management with fixed-size partitions (first adjustment) |
||
|
Contiguous memory management with fixed-size partitions (best fit) |
||
|
Contiguous memory management with variable-sized partitions (Defragmentation) |
||
|
Contiguous memory management with variable-sized partitions (Swap) |
||
|
Pagination |
||
|
Segmentation, partial allocation |
||
| Content | ||
|
Linked Allocation with FAT. File System objects |
||
|
Linked Allocation with FAT. Large block size |
||
|
Indexed Allocation (UNIX). References to i-nodes |
||
|
Indexed Allocation (UNIX). Indireccions |
||
| Content | ||
|
Fair scheduling. FIFO |
||
|
STF scheduling example. Starvation |
||
|
The elevator (SCAN) |
||
|
The improved elevator 1. Circular SCAN |
||
|
The improved elevator 2. LOOK circular |
||
| Content | ||
|
Ready queue order |
||
|
Multiprogramming or monoprogramming? |
||
|
Differences between premptive and non preemptive scheduling |
||
|
Scheduling algorithms performance comparison |
||
| Content | ||
|
Fixed-sized partitions, allocation policies |
||
|
Variable-sized partitions, address translation |
||
|
Pagination |
||
|
Segmentation |
||
| Content | ||
|
Linked Allocation, FAT |
||
|
Indexed Allocation, UNIX |
||
| Content | ||
|
Algorithm comparison |
||