W
Water Cooler v2
I want my application to do three tasks simultaneously. Each of the
three tasks must be performed at a periodic interval of time. Each of
the three tasks is somewhat complicated and is thus composed of a
number of sub-tasks that are to be performed in a linear sequence.
The three tasks are independent of each other. They do not share any
data, nor is the execution of one going to affect the other.
To ampify, assume I have three main tasks as:
Task A [performed simultaneously with Task B and Task C]
- Sub-task A.1 (sub-task within Task A)
- Sub-task A.2 (performed in linear sequence after A.1)
- Sub-task A.3 (performed after A.2)
Task B
- Sub-task B.1 (sub-task within Task B)
- Sub-task B.2 (performed in linear sequence after B.1)
- Sub-task B.3 (performed after B.2)
Task C
- Sub-task C.1 (sub-task within Task C)
- Sub-task C.2 (performed in linear sequence after C.1)
- Sub-task C.3 (performed after C.2)
The question is: how should I design my application. I am thinking of
the following options:
1. One glob executable that runs as a service and manages Task A, Task
B and Task C as three separate threads. Each thread fires off a timer
so that the thread is always active and it executes periodically.
This will, however, involve a buttload of thread management. Also, if
one thread misbehaves, the whole application will come to a halt. It
would be wrong to couple them in one process given that the tasks are
independent of each other.
2. Make each task into a separate EXE. In each EXE, take a timer that
executes the sub-tasks in linear sequence.
Create a Windows Service that watches over these independent process.
If one of them crashes or misbehaves, the Windows Service writes to the
Event Log, cleans up memory and re-starts the process afresh.
If you were in my position, what would your take on the design be? What
would you recommend?
three tasks must be performed at a periodic interval of time. Each of
the three tasks is somewhat complicated and is thus composed of a
number of sub-tasks that are to be performed in a linear sequence.
The three tasks are independent of each other. They do not share any
data, nor is the execution of one going to affect the other.
To ampify, assume I have three main tasks as:
Task A [performed simultaneously with Task B and Task C]
- Sub-task A.1 (sub-task within Task A)
- Sub-task A.2 (performed in linear sequence after A.1)
- Sub-task A.3 (performed after A.2)
Task B
- Sub-task B.1 (sub-task within Task B)
- Sub-task B.2 (performed in linear sequence after B.1)
- Sub-task B.3 (performed after B.2)
Task C
- Sub-task C.1 (sub-task within Task C)
- Sub-task C.2 (performed in linear sequence after C.1)
- Sub-task C.3 (performed after C.2)
The question is: how should I design my application. I am thinking of
the following options:
1. One glob executable that runs as a service and manages Task A, Task
B and Task C as three separate threads. Each thread fires off a timer
so that the thread is always active and it executes periodically.
This will, however, involve a buttload of thread management. Also, if
one thread misbehaves, the whole application will come to a halt. It
would be wrong to couple them in one process given that the tasks are
independent of each other.
2. Make each task into a separate EXE. In each EXE, take a timer that
executes the sub-tasks in linear sequence.
Create a Windows Service that watches over these independent process.
If one of them crashes or misbehaves, the Windows Service writes to the
Event Log, cleans up memory and re-starts the process afresh.
If you were in my position, what would your take on the design be? What
would you recommend?