473,809 Members | 2,728 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Design related question

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?

Jul 11 '06 #1
2 1081
V
Hello,

I was thinking of a third approach:

I think you should have the 1st approach with a difference:
1. The thread management is not that bad really (i have a general
purpose task schedular which deals with many threads, and the total
threading code is only 5-10 lines), since your problem is limited to 3
threads. You could use the ThreadPool or make your own threads.
2. As for the thread managment, here you can borrow from your second
approach: in that you model each of your tasks as a function in some
class, and then make sure that the function handles all exceptions that
the task can throw, and then use reflection to load this class and call
that function. This way, you have three different Dlls, each one
implementing one task, and each has a function which executes the
actual task.
3. You can then implement independent timers for each task and maybe a
4th management timer for checking the status of each task timer, etc.

its not that complicated, give it a try, let me know if you need any
help.

- Vaibhav
Water Cooler v2 wrote:
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?
Jul 11 '06 #2
Hello
If the time interval is user customizable and if the time of the day is
important, you might want to create the programs as EXEs and trigger
them by windows scheduler. It is a lot easier for end users to
customize the scheduled intervals that way.

You have to keep a lot in mind if you are creating a service with
timers - like time of first run, manual re-run etc. For example, if the
jobs need to run once in three days - would you make them run
immediately on start of service for the first time, or after three
days? Considerations about what if the job runs too soon or too late
have to be considered - or you need to store last run times etc. in the
database.

Clustered application add another level of complexity.
If there are three application servers in your cluster - would you run
it on one or all three? How will you manage high availability if its
only one and how would you manage concurrency control if its all three.

Pranshu

Jul 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
1944
by: Uwe Mayer | last post by:
Hi, I have the following inter-class relationships: __main__: (in file LMCMain.py) imports module FileIO defines class LMCMain instanciats main = LMCMain(...) FileIO.py:
9
2468
by: Patchwork | last post by:
Hi Everyone, I have a design related question (in C++) that I am hoping someone can help me with. It is related to my previous post but since it was pointed out that I was more or less asking the wrong questions about the wrong 'topic' (polymorphism) I have posted this new question. Please don't see this as a spurious attempt to repost :-) As mentioned previously, there is a very real problem I am trying to solve, but I have reduced...
6
2123
by: rodchar | last post by:
Hey all, I'm trying to understand Master/Detail concepts in VB.NET. If I do a data adapter fill for both customer and orders from Northwind where should that dataset live? What client is responsible for instantiating the orders class? Would it be the ui layer or the master class in the business layer? thanks,
4
279
by: JJ | last post by:
Hi, Ok I was reading an old ASP 3.0 Book and I noticed that when designing web applications. Everything that us windows form and vb programmers would do was to put all functions relating to a certain area in one form. Like for example I would have an employee timesheet that in a window form would do the adding/updating/deleting etc. in one form. But from my reading of this ASP book adding a timesheet would be put on one page, updating...
3
1713
by: Froefel | last post by:
I'm trying to modem a relationship with classes and I'm having trouble finding the correct design pattern. Maybe someone with more experience knows which pattern(s) I'm looking for. Here's an explanation of what I have and in which direction I'm thinking: CLASS DESIGN ============= 1. Generic class "Company" contains general company information (name, address, reference person, phone, etc...)
0
2086
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the end of this message, but I will start with an overview of the problem. I've made a content management solution for my work with a decently structured relational database system. The CMS stores articles. The CMS also stores related items --...
23
2447
by: JohnH | last post by:
I'm just recently come to work for an auto brokerage firm. My position involves performing mysterious rites, rituals and magick in order to get information out of their access database. This is due to the fact that the "designer" they hired had an unfortunate ability to tink around with a program far beyond her reach. She had no concept of any of the principles of database design, so what i'm left with is a junkpile. The only reason I...
12
7027
by: nyathancha | last post by:
Hi, I have a question regarding best practices in database design. In a relational database, is it wise/necessary to sometimes create tables that are not related to other tables through a foreign Key relationship or does this always indicate some sort of underlying design flaw. Something that requires a re evaluation of the problem domain? The reason I ask is because in our application, the user can perform x
8
2241
by: indrawati.yahya | last post by:
In a recent job interview, the interviewer asked me how I'd design classes for the following problem: let's consider a hypothetical firewall, which filters network packets by either IP address, port number, or both. How should we design the classes to represent these filters? My answer was: class FilterRule {
54
4040
by: csolomon | last post by:
Hello: I was wondering if I could get some input on how to address a design issue, involving my composite table. I have one portion of my project complete. The following forms and reports I will add, piggyback off of my existing design. The part I have already completed allows my users to create a design sample; this is made up of several materials to create one sample. I have accomplished this using this design:
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10637
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10379
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7660
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.