OS Sim v.1.0 Help


Index


Introduction

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.

Start menu

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
(Only available if
Open a simulation)

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

Languages

At the moment the application is available in three languages:

Simulations description

Process Scheduling

The 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:

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

Screen.

: Processor (CPU):

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.

: Ready queue:

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

: Incoming processes :

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.

Settings.

Sets simulation behaviour:

: Add a process:

Processes can only be added while the simulation is stopped, for each new process enter the following information:

Settings are only available while the simulation is stopped

: Data and statistics:

See resulting scheduling information at any time of the simulation.

Aggregate data are:

For each process there is a table with the following information

Memory management

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:

Screen.

: Main memory

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:

: Process queue:

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.

Settings.

Sets simulation behaviour:

Any change of algorithm, memory size or OS size requires restarting the simulation and deletes all existing processes.

: Add a process:

Processes can only be added while the simulation is stopped, for each new process enter the following information:

Addition in pagination is shown:

And in segmentation is shown:

: Data and statistics:

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)

In pagination, a table with the following information is shown

(If the partition is busy)

In segmentation, is a table with the following information

(If the partition contains a process)

: Pages table and Segments table :

Shows memory allocation information of a process in non contiguous memory management.

In pagination, table's content is

In segmentation, table's content is

: Create a partition (only fixed-sized partitions):

Simply indicate starting address and partition size .

Partitions can not overlap, nor can they terminate beyond the end of memory.

Defragment memory (only variable-sized partitions and segmentation)

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).

: Swap :

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.

: Address Translation:

: Errors in the simulation:

  1. Memory full, as it processes the queue during the simulation, the memory allocates them and finishes filling. From the moment a process can not be allocated for lack of space it does not continue with any of the subsequent processes. The memory can be released automatically (complete any process) or with user intervention (delete or swap out any process).
  2. Memory not fully partitioned fixed-sized partitions algorithm require that all the memory be partitioned (where one partition ends, the next begins.)

File System Management

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:

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:

Available Data blocks

Administration Blocks

Total data Blocks


Total Adm. Blocks

Total Blocks

One i-node

12 blocks

Head

12

0

12

First
indirection

Past more ...
20 blocks

1 indirect block

32

1

33

Second
indirection

Past more ...
20 * 20 blocks

1 indirect block
1 +20 Indirect b.

432

22

454

Third
indirection

Past more ...
20 * 20 * 20 blocks

1 indirect block
1 +20 Indirect b.
1 +20 +400 Indirect b.

8.432

433

8.875

Screen.

: Logical file system:

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:

(Device) Physical File System:

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
UNIX "I" means it is an indirect block

: View the current folder:

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 .

Settings.

Sets the simulation's behaviour:

Any change of algorithm, block size or memory size requires restarting the simulation and deletes all existing objects.

Add a file:

The file is added to the folder that is currently selected, for each new file you must enter the following information:

Add a folder:

The folder is added to the folder that is currently selected,
It is only necessary to indicate the new folder's name (required).

Add a link:

The link is added to the folder that is currently selected for each new link it is necessary to enter the following information:

: Detailed Information of an object:

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:

For MS-DOS displays the FAT table entries for the object:

: Data and statistics:

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:

: Errors in the simulation:

  1. Memory full, as new objects are created the device's blocks are occupied but there is a limited number of them. If it is not possible to create new objects for lack of space it is necessary to reduce the size of existing ones or delete them.
  2. There is another object with the same name within a directory there can not be multiple objects (files, links or subdirectories) with the same name.

Disk scheduling policies

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:

Screen.

: Disk :

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.

: Head movement graph :

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.

: Data and statistics:

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.

Settings.

Sets simulation behaviour:

Settings are only available while simulation is stopped

Add a request:

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.

Common Tasks

Open and save simulations:

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.

Time Controls

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.

Available Examples

Process scheduling examples

Content

Simple FIFO scheduling example

SJF scheduling non preemptive

Priority scheduling preemptive

Round Robin scheduling (quantum: 2)

Multiprogramming I/O

Monoprogramming I/O

Memory Management Examples

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

File System Management examples

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

Disk Scheduling Policies examples

Content

Fair scheduling. FIFO

STF scheduling example. Starvation

The elevator (SCAN)

The improved elevator 1. Circular SCAN

The improved elevator 2. LOOK circular

Available Exercises

Process Scheduling Exercises

Content

Ready queue order

Multiprogramming or monoprogramming?

Differences between premptive and non preemptive scheduling

Scheduling algorithms performance comparison

Memory Management Exercises

Content

Fixed-sized partitions, allocation policies

Variable-sized partitions, address translation

Pagination

Segmentation

File System Exercises

Content

Linked Allocation, FAT

Indexed Allocation, UNIX

Disk Scheduling Exercises

Content

Algorithm comparison