Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need a java program for a Operating System (OS) Simulation of Treading Impact

ID: 3605867 • Letter: I

Question

I need a java program for a Operating System (OS) Simulation of Treading Impact in the form of a thread oriented program.

3. This is an OS Simulation of Treading Impact exercise which you can use java to simulate Following are the rules: a. Create a multidimensional array with rows and columns, as this: Simulated Processing in milliseconds. Random(1- 10000) Task Priority Request Requester Time Echelon Random (1- 10) Random(1-1000) Random(1-5) 1 2 3 4 5 b. c. d. e. f. You need to create 5000 random records with these fields Priority 1 gets processed first/10 last Echelon 1 gets the first precedence, then the priority For process simulations use the Sleep Clause with a Fixed Second Process the Jobs in one Machine Instance (Thread) and record begin and end time to calculate total processing time g. Process the Jobs in two Machines Machine Instances (Threads) and record begin and h. When simulations are executed in multi-thread, theoretically (simulated), force each i. Record each task processing time, print a report in a file (log) by each task processing end time to calculate total processing time in both instances task to take a random of (20%-80%) more time in each task time and within a Single and the Double Threads with Total Processing Times

Explanation / Answer

Class OSSimulator{

private int Random;

private int Priority;

private int Request;

private int Simulatedpt;

private int reqEcheloen;

OSSimulator(int Random,int Priority,int Request,int Simulatedpt,int reqEcheloen){

this.Random = Random;

this.Priority= Priority;

this.Request = Request;

this.Simulatedpt = Simulatedpt;

this.reqEcheloen = reqEcheloen;

}

public int getRandom(){

return this.Random;

}

public int getPriority(){

return this.Priority;

}

public int getRequest(){

return this.Request;

}

public int getSimulatedPT(){

return this.Simulatedpt;

}

public int getEcheloen(){

return this.reqEcheloen;

}

}

public MainThread extends Thread{

public static final List<OSSimulator> listarr = new ArrayList<>();

public static void main(String args[]){

MainThread t1 = new MainThread();

  

System.out.println("t1 thread priority : " +

t1.getPriority());

  

//Creating 5000 records random

for(int i=0;i<5001;i++){

OSSimulator oss = new OSSimulator((int) Math.ceil(Math.random() * 10), (int) Math.ceil(Math.random() * 1000),(int) Math.ceil(Math.random() * 10000),(int) Math.ceil(Math.random() * 5));

listarr.add(oss);

}

int counter=0;

while(counter < 3){

ListIterator listIterator = listarr.listIterator();

while (listIterator.hasNext()) {

OSSimulator temp = listIterator.next();

t1.setPriority(temp.getPriority());

t1.start();

listIterator.remove();

break;

}

}

public void run(){

System.out.println(Thread.currentThread().getName());

System.out.println("Main thread priority : "

+ Thread.currentThread().getPriority());

Thread.sleep(2000);

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote