cpu scheduler in java problem

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Closed Thread

Join Date: Oct 2005
Posts: 6
Reputation: lain is an unknown quantity at this point 
Solved Threads: 0
lain lain is offline Offline
Banned

cpu scheduler in java problem

 
0
  #1
Oct 22nd, 2005
i need to write a simulation of CPU scheduling. The operating system must select one of the processes in the ready queue to be executed.
i have real problems understanding what the professor wants in this program, can anybody here help me develop some pseudocode for the logic behind this or try to explain to me what exactly is required here. i actually have some C++ code of a program like this, but i don't understand C++. i would like to write my own java code for this.

i need to simulate the following scheduling algorithms.

First Come, First Serve (FCFS) scheduling algorithm.

Simulate the system using FCFS scheduling. The FCFS scheduling algorithm is not preemptive (once a job starts, it runs to completion).

Shortest Job First (SJF) scheduling algorithm.

Simulate the system using SJF scheduling. The SJF scheduling is not preemptive.

Shortest Remaining Time First (Preemptive SJF) scheduling algorithm.

Simulate the system using Preemptive SJF scheduling. At any given time, you are to be running the process with the least remaining processing time.

For example, in the the following case, i am running process A. Process B arrives, which is shorter than the remaining time of process A. You enter the task switch overhead to switch to job B.

Priority Scheduling.

Simulate the system using preemptive priority scheduling.

Round Robin

Simulate the system with round-robin scheduling, using a time quantum of Q=1 and Q=10 (I.e. each of these simulations is run for each quantum size). When a new process arrives, it always goes in the back of the queue.
Data

i need to simulate the arrival of 200 processes into the ready queue to be executed and only generate the processes only once, save their process control blocks (PCB) and reuse the same processes for each simulation. The records in the queue are PCBs of the processes.

You should generate your own arrival, burst, and other service times and priorities for each process. Arrival and burst times should be given in milliseconds. Priorities should be in the range of 0 to 7. Use 0 to represent high priority.

Note that for each simulation, the i'th customer will arrive at the same time, and will require the same amount of service time. Thus any difference in performance should be due to the different scheduling algorithms, not differences in the random numbers.

For test and debugging purposes, you should also provide a sample set of five processes and calculate results manually.
Arrivals

Processes arrive with inter-arrival times. The simulation ends when the 200'th customer arrives. Note that the system starts empty, and that the first customer arrives at time T1, (not 0) i.e. after the first inter-arrival time is added to zero.

Service Times
For each scheduling algorithm, consider two cases: The time X to switch between processes is either 0.0 or 0.10. I.e. each simulation is run two times. This overhead is incurred whenever:
a) There is a task switch from job A to job B
b) A job arrives to an empty system.
c) If the clock interrupts at the end of a quantum and the same job is resumed, the overhead is X/2.

You can consider other logical overhead items.


Output
Please put together a table showing your simulation results in some clear and useful manner.
Compute throughput, the average turnaround time, and the average waiting time for all processes that have completed service and left the system

Compute the average of the inter-arrival times, for all 200 processes, and print them out.

Compute the average of the service times, for all 200 processes, and print them.

You should also show the results of all of your simulations using the test data (a sample set of five processes)



Hint.

You should write an event driven simulation, not a clock or interval type simulation. What this means is that your simulator basically cycles through the following loop:

(start loop)-> (get event)-> (reset clock to event time)->
(update system statistics)-> (update system state)->
(generate any new events and put them on event list)-> (continue loop).
Quick reply to this message  
Join Date: Oct 2005
Posts: 6
Reputation: lain is an unknown quantity at this point 
Solved Threads: 0
lain lain is offline Offline
Banned

Re: cpu scheduler in java problem

 
0
  #2
Oct 22nd, 2005
i will pay whoever helps me complete this. ^_^

//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// cpuscheduler.java
// complete this project and you get paid.
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

public class cpuscheduler {

}
Quick reply to this message  
Join Date: Oct 2005
Posts: 6
Reputation: lain is an unknown quantity at this point 
Solved Threads: 0
lain lain is offline Offline
Banned

Re: cpu scheduler in java problem

 
0
  #3
Oct 22nd, 2005
come on, will some kind soul here give me some pseudocode for these algorithms, so i can understand this better? i plan to write the java code myself. please help me with the logic behind this program. i need this asap. i'm desperate.
Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 212
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: cpu scheduler in java problem

 
0
  #4
Oct 23rd, 2005
Do you own homework, looser.
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Quick reply to this message  
Join Date: Oct 2005
Posts: 6
Reputation: lain is an unknown quantity at this point 
Solved Threads: 0
lain lain is offline Offline
Banned

Re: cpu scheduler in java problem

 
0
  #5
Oct 23rd, 2005
at least learn how to spell LOSER being calling somebody that, i'm not a computer science major dumbass. so go f**k yourself L-O-S-E-R.

System.out.println("go f**k yourself");
Quick reply to this message  
Join Date: Oct 2005
Posts: 6
Reputation: lain is an unknown quantity at this point 
Solved Threads: 0
lain lain is offline Offline
Banned

Re: cpu scheduler in java problem

 
0
  #6
Oct 23rd, 2005
in case you don't know, i have the answer to the hwk, i just don't understand it because the code i have is in c++. and i only have a little experience with java. if you can't help, then don't help. go f**k yourself instead. you probably don't even know how to program this, cause you're a stupid L-O-S-E-R, who can't even spell. :mrgreen:
Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: cpu scheduler in java problem

 
0
  #7
Oct 23rd, 2005
I think he wanted to extend the sound:
You are a:
L-o-o-o-o-o-o-ser.


I think that's what was meant, right J?
Quick reply to this message  
Join Date: Oct 2005
Posts: 15
Reputation: hatch101 is an unknown quantity at this point 
Solved Threads: 0
hatch101 hatch101 is offline Offline
Newbie Poster

Re: cpu scheduler in java problem

 
0
  #8
Oct 23rd, 2005
how do you know J is a he?...no pun intended
Quick reply to this message  
Join Date: Oct 2005
Posts: 6
Reputation: lain is an unknown quantity at this point 
Solved Threads: 0
lain lain is offline Offline
Banned

Re: cpu scheduler in java problem

 
0
  #9
Oct 23rd, 2005
he knows J is a :eek: he because he sucks his dick all the time. that's why he's a L----OOOOOOOOOOSER. :p

oh, and thank you for all your help. you people are real class acts. :rolleyes: It's nice to know such generous people who are willing to share their knowledge and help a person in need.

oh, and server crash, i told J to f**k himself, but I guess you're going to help him huh?
Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: cpu scheduler in java problem

 
0
  #10
Oct 24th, 2005
Let's show some maturity, gang.

Closing the thread-- do your own work. We're not here to hash out your code for you-- syntax is easy, your assignment was to design the scheduler, not have someone else design it, and have you implement it.

You're welcome to repost this question, provided you show your work. If not, your next post will likely be closed/deleted.

Have a nice day.
Alex Cavnar, aka alc6379
Quick reply to this message  
Closed Thread

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC