File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Thread scheduling Algorithms? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Thread scheduling Algorithms?" Watch "Thread scheduling Algorithms?" New topic
Author

Thread scheduling Algorithms?

Chetan Dorle
Ranch Hand

Joined: Aug 06, 2009
Posts: 128

Hi All,

Can anybody explain Thread Scheduling algorithms (Round robin and others).

Thanks in advance to all of you..

Regards,
Chetan.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3047
    
    1

Have you done a Google search? Is there anything specific you don't understand?
Joe Areeda
Ranch Hand

Joined: Apr 15, 2011
Posts: 181
    
    2

The answer is probably no I doubt anybody can explain them at least not well.
But that won't stop me from discussing them.

The problem is simple, you want do appear to do more things at one time than you have processors to assign to the task. So you divide the available processors among the list of tasks. The terms task, thread, process and program usually have specific and different meanings but the scheduling algorithms are pretty generic for all of them.

A program may be compute bound or i/o bound. A bunch of i/o bound tasks are pretty straight forward to schedule. For instance the one I'm using to type this message spends the vast majority of it's time waiting for me to enter the next character. So the scheduler just waits for me to hit a key then lets the program put the character in it's buffer and draw it on the screen then waits for the next one. This has several names like event driven, or interrupt driven scheduling.

For compute bound tasks the scheduler has to cut you off and give some else a chance to run. The cutoff process is usually triggered by an interrupt from a clock say once a millisecond or 10 microseconds. Round robin refers to a simple algorithm that gives each task a fixed time slice then goes to the next one. Problem is a program that computes for an hour and types done gets as much chance to hold you up as the one your typing into. Priority scheduling addresses that by giving programs whose response time is important quicker access to the processor than something that runs in the background. It's not as simple as if a high priority job is ready to run, it runs, because then the low priority jobs may never run.

Throw in multi-core processors, lots of operating system background tasks, a few servers and effective and responsive scheduling is not a trivial matter. However the algorithms are well developed and for the most part we as end user programmers can almost ignore the scheduling process and concentrate on the problem of how many simultaneous tasks to divide our programs into and how to keep those tasks from interfering with each other.

Any specific questions? I can blabber on in generalities for a long time.

Joe


It's not what your program can do, it's what your users do with the program.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread scheduling Algorithms?
 
Similar Threads
Thread synchronization + static variables + volatile variables
THread Selection By JVM Problem
Subjective Questions?
Understanding Thread Priorities
jvm alogorithms