iI know that you dont solve problem you just help in them so i have problem and try to solve it
i have a scorce code and the the DR told me to mof\difay it so i will show you the scorce code and the problem and what i do
Copy the files Parent. java, Counter. java, and Scheduler. java to your working directory. Compile and run the program (the Parent class has main()). Look closely at the output. The Scheduler is supposed to set priorities so that only one thread runs during a Scheduler time slice. However, Scheduler is running on top of the Java thread scheduler, so some interesting interactions take place. You'll be asked in lab to identify evidence that Scheduler is not completely in control.
Next, try reducing the size of the DEFAULT_TIME_SLICE constant in the Scheduler. java file (you can also pass in a quantum in Parent. java where the Scheduler constructor is called). Recompile and run the program again, and look at the output. It won't change the interactions, but you should see more frequent Scheduler activity.
Bring to lab the outputs from your original run of the program, as well as the output from a run after you reduce the time slice.
Problems
Here is the basic problem you will address. Imagine writing a Java program which will generate lots of threads. For performance reasons you want to manage the scheduling of these threads yourself - you should remember seeing the code for a Scheduler class from the pre-lab work. You will work with this scheduler to understand how this Scheduler class interacts with the JVM threads scheduler.
The thing that you must keep in mind is that your program (based on the Scheduler class) is run as a thread by the JVM - so to the JVM your program thread, the scheduler thread, and any other threads can all be in the runnable state at the same time. So that if your program's scheduler thinks it has somehow blocked the execution of a thread, that thread is ultimately managed by the JVM - it is really in control. This is why your Scheduler that is defined in the Scheduler. java doesn't have the full control.
Also, remember that the JVM schedules threads using a preemptive priority scheduling scheme.
A.
Modify the Scheduler to include 3 queues representing three different priorities (with values of 2, 3, and 4). The Scheduler should pick a thread from the highest-priority queue that is not empty, and run that thread for a time slice, until all threads in the highest-priority queue are finished. Then move to the next queue, until all queues are empty. Note that in order to implement this, you will have to change the Scheduler so that it sets the priority of the thread it is running to 5, and that it remembers the priority of the running thread so that it can be returned to the correct queue when the time slice is done. Note that you will also have to modify the addThread() method to take a second argument indicating the priority of the thread.
Once you've made the modifications, change Parent. java to start up three counters, one with priority 4, one with priority 3, and one with priority 2. Run the program and verify that it does what you expect.
Hand in the code for the modified Scheduler. java and the output of your test run