Re: How to run tasks with priority?
- From: "Boudewijn Dijkstra" <usenet@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 May 2005 19:03:37 +0200
"George George via JavaKB.com" <forum@xxxxxxxxxxxxxxxxx> schreef in bericht
news:a4ce638f7c5543e4bb1f3c3d5e711194@xxxxxxxxxxxxx
> Hello everyone,
>
>
> I want to run tasks with priority, i.e. among several simultaneous running
> tasks, the task with the higher priority will have more chances to occupy
> CPU time. I have the following 2 issues dealing with the implementation of
> such feature.
>
> - To define each task as a thread or as a method?
It would generally be wise to allocate a thread for each task. How you define
the tasks, doesn't matter much.
> - How to change the
> priority of each task dynamically when they are running?
Thread#setPriority(int)
> - The priority feature of Java thread does not meet my requirement, since I
> can not define priority precisely. For example, I want to define that a
> task with priority A will occupy CPU time 3 times than a task with priority
> B.
You can accomplish this behaviour with the Thread#yield() method.
> I am wondering whether I can find similar open source projects or tutorials?
Similar to what?
.
- References:
- How to run tasks with priority?
- From: George George via JavaKB.com
- How to run tasks with priority?
- Prev by Date: Re: Help with Java servlet : getServletContext().
- Next by Date: Encrypted NNTP ???
- Previous by thread: How to run tasks with priority?
- Next by thread: Modification of output
- Index(es):
Relevant Pages
|
|