Friday, January 31, 2020

Documentation - Customizing and Editing Process Details

(Note: This is part of the early draft for the documentation of ALExSIM-USAS, to give the basic idea and understanding about ALExSIM-USAS and its components/sections. This draft may go through more updates. Latest update - 31 Jan 2020)

Customize Process Details


This section is to allow the user to edit and prepare the process details that will become the input data for the scheduling algorithm simulation. 

Figure 1 below shows a snapshot of this section, which displays a table that appears after the user click the Generate random values button. 

Figure 1: Process details that appear in Customize Process Details section


The table for the process details will only appear if the user successfully performed one of the following actions in the Process Generation / Setup section (read about Process Generation / Setup for more explanation):
  • click the Generate random values button (create process details using generated random values)
  • click the Generate empty fields button (create process details by preparing empty table)
  • click the Import data button (create process details by loading data from existing data file)


Editing the process details


User can edit any process detail (except the ID) by double-clicking the respective cell. For example in Figure 1, if the user wants to change the arrival time for process A to become 0 (instead of 9), user can just double-click on the number 9 and change it into 0. 

The editing of the table will only accept integer value. Other type of data like alphabets or floating point number is not allowed. So if user type or enter such data, it will be invalid, highlighted in red and editing will be still active.



Exporting the process details into file


User can also export or save the process details into a file using the Export data button. 

The exported data will be saved in a specially-formatted text file with the extension *.ptd. Once the data is saved, user can later reload the data from the file using the Import data button in the Process Generation / Setup section

ALExSIM-USAS actually implements the *.ptd format using a CSV-style (comma separated values) format. Since it is just a simple text file, the exported file can be opened using any text editor. This means user can edit the exported data in a text editor, but must ensure that formatting is maintained. (If the user tries to load data from a file with corrupted or invalid or unknown format, an error message will be displayed and the data can't be reloaded.)

Also the exported data can be imported into spreadsheet application that able to load data from CSV file. This means any exported file can be imported using application like MS-Excel or OpenOffice Calc. 

That's all about the section. Next i will explain about the next step, which is about Selecting the Scheduling Algorithms section. 



Thursday, January 30, 2020

Documentation - Preparing and Generating Process Details

(Note: This is part of the early draft for the documentation of ALExSIM-USAS, to give the basic idea and understanding about ALExSIM-USAS and its components/sections. This draft may go through more updates. Latest update - 31 Jan 2020)


Process Generation / Setup


In this post, I will describe about one of the sections in ALExSIM-USAS, which is the section called Process Generation/Setup. The figure below shows an example of the section.

Step 1 : Process Generation / Setup 

The purpose of the section is to help the user to prepare the input data table. which will contain the details about the processes that will become the input for the process scheduling simulation. 

The section contains 2 sub sections - Random Data Settings, and Manual Data Settings, which will be described in the section below.


Random Data Settings


Random Data Settings in USAS provides the feature for the user to generate the input data using randomized data (instead of manually entering specific input data). Using this feature, user can automatically generates all the required input data (process' details) based on the generation settings specified by the user. 

The advantages of using this feature include, 
  • user is not required to manually enter the input data (process details) for the simulation
  • user able to produce variations or multiple set of different process details to be used for practising or experimenting with the simulation

Elements in generation settings

For generating the total number of process(es) and data for the process details (burst time, arrival time, and priority number), user is allowed to modify/set the following values:
  • Min (minimum) value - indicates the minimum / lowest random value that can be generated for a particular input.
  • Max (maximum) value - indicates the maximum / highest random value that can be generated for a particular input.
  • Mean value - indicates the mean value for random generation based on Gaussian or Normal Distribution (the Mean value should lies between the Min and Max values, inclusive). This setting require the user to set the std dev value (see the following). If the std dev value is not set, the Mean will only indicates the Mean of Min and Max.
  • Std dev (standard deviation) value - this value indicates the standard deviation from the specified mean value. User must set this value to use the Gaussian or Normal Distribution randomization. 

Using the random value generation 

For example, if the user only wants to randomly generate a value within the range 1 to 10 (let say for the total number of processes), without the concern for how many times any of the values within the range to occur, just set the settings for min=1 and max=10. Let the remaining columns blank. No Gaussian or Normal Distribution will be applied.

But if the user wants to generate a value for the input within the range 1 to 10, where most of the random values will be between 5 to 7, the user needs to set the min=1, max=10, mean=6, and std dev=1. The effects will be that most of the time the user click the Generate random values button,  will produce values between 5 to 7, and only few times other values will occur. 

This applies for all the input data (the process' details). Then, to perform the random value generation, user just need to click the Generate random values button below the settings table.

By default, all the settings are already provided with default values. So the user have options to modify or just simply click the generate button without changing any of the settings. 


Manual Data Settings


If the user doesn't want to use the random values generation (e.g. already have input data or process details), he/she can use the manual value preparation. The following figure shows the section when the tab Manual Data Settings is selected.

Manual Data Settings sub-section

The sub-section provides 2 types of manual input data preparation:
  • Create empty data table, or
  • Load data from an existing data file (*.ptd - 'process table data')
The first type will help user to create an 'empty' table so that user can enter their own data. (The table is not exactly empty, but contains some repeated default values). For example, user may fills up the table by entering the data that they have from the class exercise or other predetermined data.

Another type of manual data preparation is to load input data or process details for the simulation from an existing data file. This feature will actually allows the user to reload the same input data or process details that have been saved from previous session. The required file is a formatted text file with extension *.ptd. (This will be covered in the documentation about Customizing Process Details).

That's all for this section. In the next post i will explain about the section - Customize Process Details.


Tuesday, January 28, 2020

Tutorial 2 : Practising with Scheduling Algorithm

In this tutorial, we will look into using ALExSIM-USAS to help one practising with scheduling algorithm.

Let say you are a student in the Operating System course, and is given an exercise on scheduling algorithm which comprises a list of process details as follow: 


You are asked to manually calculate and perform First-Come-First-Serve scheduling algorithm for the process details above, and determine the following:
  • the completion time
  • the turnaround time, and
  • the average waiting time.

Lets assume that you manage to produce some calculated information as your answer.

But how to verify the answer (other than waiting for the answer scheme from the instructor or just relying on luck)? In this situation, USAS can help to prepare the expected answer or the answer scheme.

Using ALExSIM-USAS to prepare the result


First what you need to do is to prepare the 'empty' process details table. Click the Manual Data Settings tab. The given exercise data contain 5 processes, so enter value 5 for the ‘number of process(es)' and click the Generate empty fields button.


Manual Data Settings section

Once the empty table is generated in Customize Process Details section, enter the data from the exercise in the generated table. (You may use the same priority number for all processes if the data are not available from the exercise)

After manually editing the process details according to the exercise

Then select the scheduling algorithm required for the exercise, which is the First-Come-First-Serve (FCFS). (By default, this algorithm is already selected by USAS).

Click the Run Simulation button to produce the expected result.

By default, in the result section will display the Summary tab which shows the Average Waiting Time and the Gantt charts (character-based or graphical-based), as follows:

The generated result shown in the bottom section (Summary tab).

This may not be enough. To view more details, click the Details tab, which displays the other required details such as the completion time, waiting time, turnaround time and others.

The generated result displayed in Details tab

Advantage in using ALExSIM-USAS for self-practising


USAS provides more advantages in helping student to do self-exercise. You may create a lot of different settings for the process details as your own 'question' for self-exercise and practice, calculate the answer manually and then easily verify your answer. Produce your own answer first and then verify.

An instructor for Operating System course/subject also can get benefits from using USAS. Since USAS can automate the calculation for the average waiting time, etc., this will help the instructor to produce answer scheme for student's exercise or for examination, faster and much easier (especially for the preemptive algorithm such as SJF preemptive and Round-Robin).

  

Wednesday, January 22, 2020

Tutorial 1 - Introduction on simulating scheduling algorithm

The main objective of ALExSIM (USAS), or simply USAS, is to help individual such as students (or even lecturers) to simulate or experimenting with the uniprocessor (process) scheduling algorithms. 

These algorithms are commonly studied in operating system subject/course, since process scheduling is one of the fundamental roles for the kernel as the core component (nucleus) of an operating system. 

To make it simple, we will not delve deep into the details about process scheduling here. But in this tutorial, we will learn about how to simulate the process scheduling algorithm named Round-Robin, using USAS. Once we have covered the steps, the same steps are applicable to test other scheduling algorithms currently supported in USAS.

STEP 1 - Setting up the process details for simulation.

The first thing to do is to prepare the simulation data, which are the process details. The required process details for the simulation include the following: 
  • process ID - normally a unique integer number to identify a running process. USAS will auto-generate the ID for each process. (Currently USAS can support or can generate only up to 60 processes in a single simulation, and will use alphabet instead of integer to represent ID)
  • burst time - this refers to the (estimated) length of time for a specific process to execute (from start until complete). 
  • arrival time - this refers to the (estimated) time a process will be loaded (arrive) for execution.
  • priority number - in real operating system, priority number will be given for each process, especially if the scheduler is using the priority-based scheduling (such as HPF). In USAS, these data are optional, except for the HPF algorithm.

USAS allows us to prepare the data (process details) in two ways - manually, or automatically generated using random values. By default USAS will show the latter option, which is to generate the data using random data, along with the default settings for the range of random values to be generated.

Options for data preparation (process details)

Click the Generate random values button to apply the default settings and generate the process details. Please note that user can also 
  • change/modify the default settings for the random value generation before clicking the Generate button.
  • regenerate the random values multiple times
(Optionally, if we already have our own process details, we may select the Manual Data Settings tab to prepare the empty table for the process details and fills up the details manually.)

STEP 2  (optional) - Editing the process details.

After the data generation, we should have the randomly generated data for the process details, such as the example shown below: (the process details table is located in section labelled 'Step 2 ...', just below the data generation button in the interface):

The Generate random button (above) and the list of processes with randomly generated details (below)
Optionally, except for the process ID, we may want to change/modify the generated values (by double-clicking any cell in the data table) to fulfill certain requirement. For example, if we need to ensure at least one of the arrival times for processes is 0, we just click and edit. If not necessary, then just use the generated data.

STEP 3 - Selecting the scheduling algorithm(s)

After we have prepared the process details, we need to select the scheduling algorithms to simulate.  The section is labelled 'Step 3 ...' and is located on the right-hand side of the interface. 

By default the First-Come-First-Serve algorithm is already selected. But since we want to simulate Round-Robin algorithm, we deselect the default option and select the Round-Robin. Round-Robin requires additional parameter which called the quantum time slice. Since we already provided with the default value quantum slice = 3, we just use it. USAS facilitates most of the steps with default options to allow easy preparation.

Selecting Round-Robin algorithm (above) and click the Run Simulate (below)

STEP 4 - Run the simulation.

Finally, after we have prepared all the data and settings we need, we click the Run Simulation button to perform the simulation and produce the following result, which will appear in the bottom section of the interface:

The result of Round-Robin algorithm simulation
There several outputs/results generated from the simulation. The most common results that we need are the average waiting time and the Gantt chart (in ASCII form or graphical). However USAS provides additional information such the turnaround time, waiting time and completion time for each process, and also the steps performed in the algorithm during the simulation. 

To summarize, following are the steps to use USAS:
  1. Generate the random process details or generate empty spaces for manual entry.
  2. Edit the process details.
  3. Select the scheduling algorithm.
  4. Run simulation and get results.


That's all for the basic tutorial of using ALExSIM (USAS).


Tuesday, January 21, 2020

Announcing the release of ALExSIM version 1.0 Beta

This is the announcement for the release of the first (Beta) version of ALExSIM 1.0.

The release can be downloaded here : ALExSIM ver 1.0 (Beta)

The distribution file (ZIP) should contain the following items:
  • AlexsimUsasEval.jar
  • lib folder (contains the required library files)
  • Readme.txt
To install, download and extract the ZIP file in a chosen directory.
The application is a Java application and require the Java Virtual Machine (JRE 1.8 and above).
The readme.txt contains the instructions on how to run the application.

Currently the fully functional evaluation version will be offered until 1 April 2020. After this date, the evaluation copy will only offer basic or limited functions.

The first complete version is planned to be released in June 2020.



About the application :

ALExSIM (USAS) is an algorithm learning and experimenting simulator suite, which is targeted for anyone who are interested to study, or currently studying operating system subject/course. USAS or Uniprocessor Scheduling Algorithm Simulation is a package offered in ALExSIM, which allows the user to try and experiment with algorithms that have been used or studied for uniprocessor scheduling used in various operating systems.

Currently ALExSIM (USAS) allows users to experiment with several algorithms including First-Come-First-Serve (FCFS), Round-Robin (RR), Shortest-Job-First (SJF) and High-Priority-Job-First (HPF). 

Features provided in ALExSIM (USAS) includes :
  1. Simulating and comparing several scheduling algorithms.
    • Allow user to run simulation on several algorithms at once and compare the results between the algorithms
  2. Generating and test the algorithms using random data.
    • Easy for user to prepare and study many cases/scenarios by just clicking buttons (instead of manually entering/typing data)
  3. Generating the graphical Gantt chart (using the JFreeChart Java library).
    • Simulation results can be visualized and easier to study or compare
  4. Exporting generated results data into a CSV-formatted file.
    • The simulation results can be exported to external file, and then easy to be imported into a spreadsheet application (e.g. MS-Excel or OpenOffice Calc) 
  5. Importing prepared simulation data from a CSV-formatted file.
    • Easy to automate and repeat the testing or simulation using the same data without manually entering / typing the required input data.


Below are some screenshots from the application:

The initial interface

Generating the random process data

Running the simulation

Comparing the Gantt charts from the results



Announcing the release of ALExSim-USAS version 1.0 (full version)

This is the announcement for the release of the new version of ALExSIM (USAS) ver 1.0 (full version) The release can be downloaded from ...