THE UNIVERSITY COLLEGE COMP 3411: Operating Systems 1 TRU Open Learning Assignment 4 – Simulation of CPU Scheduling Algorithms (10%) Introduction Assignment 4 contributes 10% towards your final course...

1 answer below »
Im attaching the files.


THE UNIVERSITY COLLEGE COMP 3411: Operating Systems 1 TRU Open Learning Assignment 4 – Simulation of CPU Scheduling Algorithms (10%) Introduction Assignment 4 contributes 10% towards your final course grade and the assignment total is 14 marks. You should begin Assignment 4 in Module Eight; it is due at the end of Module Nine. Check your Course Schedule for the precise due date. Directions for submitting Assignment 4 to your Open Learning Faculty Member for grading can be found in the “Assignment and Project Instructions” document located on your Homepage. An assignment marking criteria and your assignment submission details follows at the end of this document. In this assignment, you will simulate various CPU scheduling algorithms. The efficiency of Operating System depends on two main factors: • Algorithms used for scheduling; and • The environment in which this algorithms are implemented. One of the methods used in evaluation of CPU scheduling algorithms is simulation on historical logs or samples generated by a random number generator with certain parameters of processes in a given environment. This is more popular, and random number generators generate samples using queuing theory and probability theory. Instructions Design and implement a simulation program that will allow evaluation of following CPU scheduling algorithms: • FCFS without preemption • SJF without preemption • Priority with preemption • RR without preemption. This program should include the above four algorithms, OR you can use one program for each scheduling algorithm. 2 Assignment 4 TRU Open Learning Input data for simulation could be obtained by using SampleGenerator.java. Use the seven Java files in the Assignment 4 Sample Process Generator Java File Folder located on your Home Page. SampleGenerator asks to enter: • Minimum priority (with 0 as the highest) • Maximum CPU burst time in ms • Average process arrival interval in ms • Total simulation time in ms, and • Output file name It will generate samples (records of process number, arrival time, priority, and CPU burst time) and save them in the output file. SampleReader.java could be used to read samples, and SampleReaderTest.java contains sample codes how to read the samples from the sample file generated by SampleGenerator. You need to generate samples for at least 3600000 ms (1 hr). Your simulation program will generate the followings at every minute for in total 4 different algorithms: • Average waiting time for the past 10 minutes • Average turnaround time for the past 10 minutes Algorithm could be: // Ready queue is a sort of priority queue: arrival time for FCFS, priority for Priority, CPU burst time for SJF // and the entering time into the queue for RR For (current = 0; current < sim_time;="" current++)="" {="" if="" there="" is="" no="" sample="" process="" read="" a="" sample="" process="" from="" the="" sample="" file;="" if="" the="" arrival="" time="" of="" the="" sample="" process="=" current="" put="" the="" sample="" process="" into="" the="" priority="" queue;="" comp="" 3411:="" operating="" systems="" 3="" tru="" open="" learning="" if="" there="" is="" a="" running="" process="" if="" the="" terminating="" time="" of="" the="" process="=" current="" remove="" the="" process="" from="" the="" cpu="" else="" if="" rr="" &&="" the="" timer="" expires="" rr="" scheduling="" remove="" the="" process="" from="" the="" cpu="" put="" the="" process="" into="" the="" priority="" queue="" if="" preemptive="" preemptive="" scheduling="" get="" a="" sample="" process="" from="" the="" priority="" queue="" compare="" the="" priority="" if="" the="" priority="" of="" the="" running="" process="" on="" the="" cpu="" is="" lower="" remove="" the="" process="" from="" the="" cpu="" put="" the="" process="" into="" the="" priority="" queue="" dispatch="" the="" new="" sample="" process="" to="" the="" cpu="" else="" put="" the="" sample="" process="" back="" into="" the="" priority="" queue="" else="" if="" the="" priority="" queue="" is="" not="" empty="" get="" a="" sample="" process="" from="" the="" priority="" queue;="" dispatch="" the="" process="" to="" the="" cpu;="" }="" 4="" assignment="" 4="" tru="" open="" learning="" again,="" the="" following="" java="" files="" can="" be="" found="" in="" the="" assignment="" 4="" sample="" process="" generator="" java="" file="" folder="" folder="" on="" the="" homepage="" in="" your="" course="" management="" system:="" •="" samplegenerator.java="" •="" samplereader.java="" •="" priorityqueue.java="" •="" queueitem.java="" •="" processcontrolblock.java="" –="" you="" can="" extend="" this="" class="" to="" keep="" some="" information="" for="" your="" simulation="" •="" keyboardin.java="" •="" samplereadertest.java="" public="" class="" samplereadertest="" {="" public="" static="" void="" main(string="" args[])="" {="" priorityqueue="" readyq="new" priorityqueue();="" processcontrolblock="" pcb;="" samplereader="" sr;="" string="" samplefile;="" int="" process,="" arrival,="" priority,="" burst;="" system.out.print("sample="" file?="" ");="" samplefile="KeyboardIn.readLineWord();" sr="new" samplereader(samplefile);="" while(true)="" {="" process="-1;" arrival="-1;" priority="-1;" burst="-1;" process="sr.readProcess();" if="" (process="">< 0)="" break;="" arrival="sr.readArrival();" if="" (arrival="">< 0)="" break;="" priority="sr.readPriority();" if="" (priority="">< 0)="" break;="" burst="sr.readBurst();" if="" (burst="">< 0) break; comp 3411: operating systems 5 tru open learning pcb = new processcontrolblock(process, arrival, priority, burst); readyq.putqueue(pcb, arrival); } while(!readyq.isempty()) { system.out.println(readyq.gethighestpriority()); pcb = (processcontrolblock)readyq.getqueue(); system.out.println(pcb.getprocessno() + " " + pcb.getarrivaltime() + " " + pcb.getpriority() + " " + pcb.getcpubursttime()); } } } report submission details you need to submit a report that consists of: • short description and analysis of the simulation result • java source files • two comparison graphs: one for the average waiting time and the other for the average turnaround time • screen shots that show how your programs work. assignment marking criteria weighting comprehensive, insightful written analysis of simulation result /4 two accurate and properly labeled comparison graphs – one for average waiting time; one for average turnaround time (1 mark for each graph) /2 four algorithms that are developed and implemented into program correctly /4 no syntax error: all requirements are fully implemented without syntax errors. submitted screen shots will be reviewed with source code. /4 total /14 assignment 4 – simulation of cpu scheduling algorithms (10%) introduction instructions report submission details weighting assignment marking criteria 0)="" break;="" comp="" 3411:="" operating="" systems="" 5="" tru="" open="" learning="" pcb="new" processcontrolblock(process,="" arrival,="" priority,="" burst);="" readyq.putqueue(pcb,="" arrival);="" }="" while(!readyq.isempty())="" {="" system.out.println(readyq.gethighestpriority());="" pcb="(ProcessControlBlock)readyQ.getQueue();" system.out.println(pcb.getprocessno()="" +="" "="" "="" +="" pcb.getarrivaltime()="" +="" "="" "="" +="" pcb.getpriority()="" +="" "="" "="" +="" pcb.getcpubursttime());="" }="" }="" }="" report="" submission="" details="" you="" need="" to="" submit="" a="" report="" that="" consists="" of:="" •="" short="" description="" and="" analysis="" of="" the="" simulation="" result="" •="" java="" source="" files="" •="" two="" comparison="" graphs:="" one="" for="" the="" average="" waiting="" time="" and="" the="" other="" for="" the="" average="" turnaround="" time="" •="" screen="" shots="" that="" show="" how="" your="" programs="" work.="" assignment="" marking="" criteria="" weighting="" comprehensive,="" insightful="" written="" analysis="" of="" simulation="" result="" 4="" two="" accurate="" and="" properly="" labeled="" comparison="" graphs="" –="" one="" for="" average="" waiting="" time;="" one="" for="" average="" turnaround="" time="" (1="" mark="" for="" each="" graph)="" 2="" four="" algorithms="" that="" are="" developed="" and="" implemented="" into="" program="" correctly="" 4="" no="" syntax="" error:="" all="" requirements="" are="" fully="" implemented="" without="" syntax="" errors.="" submitted="" screen="" shots="" will="" be="" reviewed="" with="" source="" code.="" 4="" total="" 14="" assignment="" 4="" –="" simulation="" of="" cpu="" scheduling="" algorithms="" (10%)="" introduction="" instructions="" report="" submission="" details="" weighting="" assignment="" marking="">
Answered Same DayApr 11, 2021

Answer To: THE UNIVERSITY COLLEGE COMP 3411: Operating Systems 1 TRU Open Learning Assignment 4 – Simulation of...

Pratik answered on Apr 16 2021
146 Votes
Java/FCFS.class
public synchronized class FCFS {
public void FCFS();
public static void m
ain(String[]);
}
Java/a
Java/SampleReaderTest.class
public synchronized class SampleReaderTest {
public void SampleReaderTest();
public static void main(String[]);
}
Java/PriorityQueue.class
public synchronized class PriorityQueue {
QueueItem head;
int noItems;
public void PriorityQueue();
public boolean isEmpty();
public void putQueue(Object, int);
public Object getQueue();
public int getHighestPriority();
public int getNoItems();
}
Java/SJF.class
public synchronized class SJF {
public void SJF();
public static void...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here