views:

36

answers:

1

Hi,

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 care 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.

+1  A: 

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.

Ade Miller