开发者

Any task-control algorithms programming practices?

开发者 https://www.devze.com 2022-12-26 15:06 出处:网络
I was just wondering if there\'s any field which concerns the task-control programming (or at least that\'s the way I call it).

I was just wondering if there's any field which concerns the task-control programming (or at least that's the way I call it).

For a better explanation of task-control consider the following scenario:

An application (master-thread) waits for a command - which might be a particular action or a set of actions the application should perform.

When a command is received the master-thread creates a task (= spawns an independent thread which actually does the action) and adds a record in it's task-list - thus keeping track of the time of execution, thread handle, task priority...etc.

The master-thread awaits for any other incoming commands while taking c开发者_如何学JAVAare of all the tasks - e.g: kills tasks running too long, prioritizes tasks with higher priorities, kills a task on a request of another task, limits the number of currently running tasks, allows task scheduling, cleans finished tasks (threads) and so on. The model is pretty similar to what we can see in OS dealing with running processes.

Are there any good practices programming such task-models or is there some theoretical work done in this field? Maybe my question is too generalized, but at least I wanted to know whether there are any experiences working on such models or if there's a better approach.

Thanks for any answers.


There are a number of patterns which may help you here.

http://parlab.eecs.berkeley.edu/wiki/patterns/patterns

Task queue and master/worker would be reasonable places to start.

0

精彩评论

暂无评论...
验证码 换一张
取 消