School of Information and Physical SciencesSemester 2, XXXXXXXXXXCOMP2240/COMP6240 - Operating SystemsAssignment 1 (10%)Submit using Canvas by 11:59 pm, Friday 26th August 20221.Task:Write a program...

1 answer below »
School of Information and Physical SciencesSemester 2, 2021 - COMP2240/COMP6240 - Operating SystemsAssignment 1 (10%)Submit using Canvas by 11:59 pm, Friday 26th August 20221.Task:Write a program that simulates First Come First Serve (FCFS), Round Robin (RR), Narrow Round Robin(NRR), and Feedback constant (FB) scheduling algorithms. For each algorithm, the program should list theorder and time of the jobs being loaded in the CPU and compute the turnaround time and waiting time forevery job as well as the average turnaround time and average waiting time for the set of processes.The average values should be consolidated in a table for easy comparison (check the sample outputs).Two sample input data sets and the corresponding outputs have been supplied. Additional datasets will beused to test your program. The format of the input data will be the same as in the supplied sample files.Each input data set contains the following information (check the sample input files for exact format):1. Time for running the dispatcher (DISP) which can be zero or more2. For each process: process id (ID) , arrival time (Arrive) and service time (ExecSize). It can beassumed that process P_i will always arrive before or at the same time of process P_(i+1).Dispatcher: It is assumed that the dispatcher runs to select the next process to run. The dispatcher shouldbehave as follows:(i) The time to run the dispatcher (context switching time) is fixed and taken as input (DISP) fromthe input file. No other time is wasted in switching between processes other than this.(ii) If there is only one process running in the processor and no other process is waiting in the readyqueue then there is no need to switch the process and the dispatcher will NOT run. For example,in RR scheduling if process P1 is running in the CPU and no other process is waiting in the readyqueue then P1 will continue even after its time quantum expires – no need to interrupt P1 to sendit back to ready queue after its time quantum expires and then run the dispatcher to reload P1from the ready queue.(iii) If the dispatcher starts at t1 and finishes at t2 (i.e. time to run the dispatcher is t2-t1) then in thatrun it will choose from the processes that have arrived at or before t1. It will not consider anyprocess that arrives after t1 for dispatching in that run.(iv) If a process P1 is interrupted at t1 and another process P2 arrives at the same time t1 then thenewly arrived process P2 is added in the ready queue first and the interrupted process P1 is addedafter that.(v) If two processes Px and Py have all other properties same (e.g. arrival time) then the tie betweenthem is broken using their ID i.e. Px will be chosen before Py if xSome details about the scheduling algorithms are as follows:FCFS: Standard FCFS scheduling algorithm.RR: Standard RR scheduling algorithm with time quantum of 4 milliseconds.NRR: NRR Scheduling is a variant of the standard Round Robin (RR) scheduling in which each process hasits own time quantum q. Each process starts with q = 4ms and q is decreases by 1ms each time the processgoes through the round robin queue, until it reaches a minimum of 2 ms. Thus, long jobs get decreasinglyshorter time slices.FB: Standard FB constant scheduling algorithm with time quantum of 4 milliseconds and a 6 level priority(0 is highest priority and 5 is lowest priority). No priority boosting is used.1.1. Additional Task for COMP6240 Students: [NOT for COMP2240 students]In addition to the above simulations, you are to implement a Round Robin (RR) scheduling simulation for adual processor system. Assume that two processors share the same ready queue and the time quantum forprocessor 1 is 2 milliseconds and for processor 2 is 3 milliseconds.For dispatching a process, the dispatcher will run on the processor that is idle. If both processors are idle atthe same time and there are jobs in the ready queue then at first the dispatcher will run on processor 1 and itwill dispatch a process in processor 2, if there are more processes, it will be dispatched to processor 1 in thesame run of dispatcher. If one processor becomes idle, then the dispatcher will run in that processor and willdispatch a process for it.Output the same data as required for the other simulations. Additionally you will need to specify in whichprocessor a job is assigned at a specific time [i.e. instead of T1: p1 use P1-T1: p1 to clarify that theprocess 1 (p1) is running in processor 1 (P1) starting at time 1 (T1)].2.Other Submission Requirements:Your submission must also conform to the follow considerations.2.1. Programming Language:The programming language is Java, versioned as per the University Lab Environment (Note this appears tohave been rolled back on the Lab machines, which means we’re currently targeting a subversion of Java 11– so please be conscious of this). You may only use standard Java libraries as part of your submission.2.2. User Interface:The output should be printed to the console, and strictly following the output samples given in the assignmentpackage. While there are no marks allocated specifically for the Output Format, there will be a deductionwhen the result format varies from those provided.2.3. Input and Output:Your program will accept data from an input file of name specified as a command line argument. The samplefiles datafile1.txt and datafile2.txt (containing the set1 and set2 data) are provided todemonstrate the required input file format. Hint: the Java Scanner Library is something you will likely wantto use here!Your submission will be tested with the above data and will also be tested with other input files.Your program should output to standard output (this means output to the Console). Output should be strictlyin the order FCFS, RR, NRR, FB, Summary.The sample files datafile1_output.txt and datafile2_output.txt (containing output fordatafile1.txt and datafile2.txt respectively) are provided to demonstrate the required output(and input) format which must be strictly maintained. If output is not generated in the required formatthen your program will be considered incorrect.Two Gantt charts are provided to explain the corresponding behaviour of different algorithms and thedispatcher for the two sample data files.2.4. Mark Distribution:Mark distribution can be found in the assignment feedback document (Assign1Feedback2240.pdf andAssign1Feedback6240.pdf).2.5. Deliverable:1. Your submission will contain your program source code with documentation and the report (below) inthe root of the submission. These files will be zipped and submitted in an archive namedc9876543.zip (where c9876543 is your student number) – do not submit a .rar, or a .7z, oretc.2. Your main class should be A1.java your program will compile with the command line javacA1.java and your program will be executed by running java A1 input.txt.…where input.txt can be any filename – do not hardcode filenames or extensions!Note: If your program can not be compiled and executed in the expected manner (above) then pleaseadd a readme.txt (containing any special instructions required to compile and run the source code)in the root of the submission. Please note that such non-standard submissions will be marked withheavy penalty.3. Brief 1 page (A4) report, reviewing the results from your program and any interesting observations.Specifically, write a note about the type of testing was done, the relative performance of the algorithmsbased on your implemented versions of the algorithms, any unexpected behaviour you noticed in anyof the algorithms.NOTES:a) Assignments submitted after the deadline (11:59 pm 26th August 2022) will have the maximum marksavailable reduced by 10% per 24 hours.b) If your assignment is not prepared and submitted following above instructions then you will lose mostof your marks despite your algorithms being correct.Nasim and Danv1.0 2022-08-05
Answered Same DayAug 24, 2022University of Newcastle

Answer To: School of Information and Physical SciencesSemester 2, XXXXXXXXXXCOMP2240/COMP6240 - Operating...

Aditi answered on Aug 24 2022
67 Votes
REPORT
Data File 1
Because all of the processes start at the same time, the FCFS algorithm does have the longest waiting time and the slowest turnaround of all
of the algorithms. This is because all of the processes arrive at the same time. The method is not renowned for starving processes; nonetheless, it will hunger processes that are near the end of a ready queue due to the fact that they arrived at the same time. Process 1 is given a turnaround time that is appropriate, but the other processes are given turnaround times that are unreasonable as a result of the lengthy service time for process 1. The Round Robin algorithm has a satisfactory level of performance since the time slice is sufficient for finishing the majority of the task in only 1 time slice. A response time for each of the processes is longer than the time taken by the algorithm that prioritises those who arrive first. Every process is given equal consideration, and none of the processes are allowed to go without food.
Due to the fact that both processes arrive at their destination at the same time, the output generated by the feedback steady algorithm and the Round Robin algorithm are identical. This indicates that the processes proceed through priority queues in the sequence in which they were added, and thus the algorithm runs in the exact same manner as a RR algorithm. The execution time that is permitted for the process is reduced by the Narrow Round Robin algorithm after each processing, which contributes to the method's somewhat superior performance compared to that of the Round Robin and FB algorithms. If it is handled for the 2nd...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here