java - Handling tasks with different priorities in a thread pool -
i have many incoming tasks of priority a, b , c , want handle tasks thread pool on multicore cpu. 70% of cpu should used process 'type a' tasks, 20% of cpu 'type b' tasks  , 10% of cpu 'type c' tasks.
if however, tasks of 'type c' arrive, 100% of cpu should devoted them. if task b , c arirve 66% proccess task b , 33% task c, etc...
how implement in java?
p.s: priority queue won't work because type tasks processed. also, assigning priorities threads wont work because not accurate.
maybe should use 3 pools of threads then. 1 pool of 7 threads tasks, 1 pool of 2 threads b tasks, , 1 pool of 1 thread c tasks.
edit: have parallelism if there c tasks (or, if have many processors, if have b , c tasks), multiply number of threads in each pool number of processors, or number of processors + 1, or other bigger factor like.
Comments
Post a Comment