Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

first-come-first-serve (FCFS) scheduling  RSS feed

 
ramjcp kris
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all

I am new to java .can any one suggest how can first-come-first-serve (FCFS) scheduling can be achevied in java. if possible pls provide me a sample code .
thanks in advance
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I'm aware you can't control scheduling in Java. The best you can do is attempt to influence it with priorities.
 
Henry Wong
author
Sheriff
Posts: 22832
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With Solaris, the "influence" is actually pretty good. You can actually starve threads by using the correct priorities.

With Windows, the "influence" is much weaker. Windows have built in algorithms to prevent thread starvation -- which IMO, is correct for 99 44/100 percent of the time.

Windows also have less priority mappings for regular time share applications, so some adjacent priorities are actually the same in Windows.

Henry
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean by first come first served. A thread pool consuming tasks from a queue will start tasks in FIFO order. No clue when they might finish, though, unless the thread pool size is 1.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!