473,408 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

12 apps safer than 1 app with 12 threads?

Let's say some one makes the argument that instead of multi threading an
application, they say it's better just to make multiple applications. The
app does the same thing for different modules. The modules are conceptually
the same. They contain mostly data but some processing to get data. The
app knows nothing about how they get the data. Just that they return data
in a starndard format. The argument is based on 12 apps vs. 1 multi
threaded app. 1 app can crash and leave the others alone. Whereas a multi
threaded app can have one thread crash and bring down the whole thing.

Consider the multi threaded app uses an interface with 12 classes to
encapsulate variability. Most work is done in one main class on the other
side of the interface and makes use of these 12 classes. I say
encapsulating the variability and using the interface is best. As for one
thread bringing down the whole app, there are two places to catch this.
First, if one thread has a problem, it's own error catching should take care
of it. Second, if the problem falls through the child thread, the main
thread can catch it. Of course, if there is a problem in the main thread,
all 12 child threads have an issue since the main thread must run. The
whole thing may stop at this point.

Contrast that with the 12 different applications. If one of the apps have a
problem in the main processing area because it received bad data from its
child class, the other 11 apps keep on going.

My question is, without regards to code maintenance, which clearly the
interface design wins hands down, or other topics, is the 12 app model
better than the multi threaded app that basically puts each app on its own
thread in the same process?

Thanks,
Brett
Nov 17 '05 #1
2 1205
This is probably not the opinion you want to hear, but here goes:

If your reason for desiring to put the 12 threads into 12 separate
applications is for robustness against crashes, then you're basically saying
"Sure I want robustness, but I'm not actually willing to do the work of
checking return codes, handling exceptions, failing gracefully, etc., in my
threads."

If you're going to go ahead and admit that openly and proceed from that
standpoint, then heck yeah, you'd _better_ put everything into separate
applications. Implementing the inter-process communication between the 12
is harder, to be sure, than communicating between threads with simple events
and EventArgs objects, and as one can assume that you're going to be equally
sloppy about implementing the IPC, that's just one more set of bugs you'll
be creating that having stuff in 12 separate processes might (but probably
won't) help you with.

Seriously, though: the simpler of two equally functional strategies is
almost always the better one. If you really need 12 threads for something,
then have 12 threads, but go to the bother of doing it right. After all,
the C# compiler guys went to a lot of trouble to give you an easy "try{ }
catch { } finally { }" idiom to work with exactly so that it's _easy_ to do
the right thing. So just do that and get on with the interesting part of
whatever it is you're implementing. Don't set yourself up for debugging
hell.

--
I may not always have the best answers, but at least I'm not posting
questions in the wrong newsgroups...
"Brett" <no@spam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Let's say some one makes the argument that instead of multi threading an
application, they say it's better just to make multiple applications. The
app does the same thing for different modules. The modules are
conceptually the same. They contain mostly data but some processing to
get data. The app knows nothing about how they get the data. Just that
they return data in a starndard format. The argument is based on 12 apps
vs. 1 multi threaded app. 1 app can crash and leave the others alone.
Whereas a multi threaded app can have one thread crash and bring down the
whole thing.

Consider the multi threaded app uses an interface with 12 classes to
encapsulate variability. Most work is done in one main class on the other
side of the interface and makes use of these 12 classes. I say
encapsulating the variability and using the interface is best. As for one
thread bringing down the whole app, there are two places to catch this.
First, if one thread has a problem, it's own error catching should take
care of it. Second, if the problem falls through the child thread, the
main thread can catch it. Of course, if there is a problem in the main
thread, all 12 child threads have an issue since the main thread must run.
The whole thing may stop at this point.

Contrast that with the 12 different applications. If one of the apps have
a problem in the main processing area because it received bad data from
its child class, the other 11 apps keep on going.

My question is, without regards to code maintenance, which clearly the
interface design wins hands down, or other topics, is the 12 app model
better than the multi threaded app that basically puts each app on its own
thread in the same process?

Thanks,
Brett

Nov 17 '05 #2

"Marcos Stefanakopolus" <ta*******@hotmail.com> wrote in message
news:42********@news.microsoft.com...
This is probably not the opinion you want to hear, but here goes:

If your reason for desiring to put the 12 threads into 12 separate
applications is for robustness against crashes, then you're basically
saying "Sure I want robustness, but I'm not actually willing to do the
work of checking return codes, handling exceptions, failing gracefully,
etc., in my threads."


This is good. Basically nail in coffin...silver bullet for the guys arguing
12 apps are better. Thanks.

Brett
Nov 17 '05 #3

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

Similar topics

4
by: Mark Fletcher | last post by:
Hi, Im in the process of writing a program that crawls a website. Im using the HttpWebRequest and HttpWebResponse classed to get content. To make my application more scalable, my application is...
8
by: Pradyot Dhulipala | last post by:
Can some one please point me to a comprehensive resource for writing C programs?I checked out Steve Summit's FAQ. Thanks, Pradyot
4
by: BBFrost | last post by:
Ok, We have a number of c# >> WinForms << apps deployed to our field offices. The apps are installed on individual Win 2000 workstations. The offices have broadband internet connections. ...
4
by: Edward W. | last post by:
Can you do multi-threading in web applications? I basically understand how to do it in winforms but am not sure about it in web apps. Can someone point me to to an exmaple or an article that...
3
by: Manuel | last post by:
I've playing around with multi-threading applications lately. The main problem I have is that when I create a file/table/whatever I need a unique name. The only way I could come up with, is asking...
5
by: Mark Harrison | last post by:
I'm looking for feedback from anybody who has used pg in a multi-threaded program, particularly one in which several threads each open a database connection. It's documented to work in that...
5
by: Brian Kitt | last post by:
I wanted to post this on the SQL newsgroup, but I get a 'page not found' when trying to go to that newsgroup. Since it is a C# app, I'll try it here. I have a C# web application (.NET 1.1). I...
9
by: Jim | last post by:
With .net having been around for a while now, does anyone know what the uptake of major software houses is in using .net for Windows Application development? e.g. have the likes of Adobe, MS,...
10
by: morangolds | last post by:
Hi, I've been having a problem with C++ Windows Forms apps not "ending" when you close the form window. I've searched about this problem all over the place and most searches have lead me to...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...

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.