473,503 Members | 3,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reentrant (?) Console Application....

I need a way for my console application to stay running and be able to
be called at any time with some parameters, do it's work, then wait to
be called again, repeat.

Here's the details:

I have a C# engine that's used to run a lot of complex financial
calculations and return a report based upon the calculated results. My
program is called by another program... let's just call it "MasterApp"
and i'll call my program "Calc". Calc is the console app exe.

Here's the basic process:
1. User inputs some data into MasterApp.
2. User clicks tells MasterApp to "Go".
3. MasterApp writes out an xml file, then launches "Calc.exe"
4. Calc reads the xml to create the inputs that it understands
(there's some translation there).
5. Calc calls some of it's own dlls (C#), etc. with the translated
inputs.
6. The "guts" of calc.exe (the dlls which are called) take the inputs,
pull the data it needs, calculates and returns a report.
7. The report is written to a directory specified as a paramater to
the calc.exe call.
8. Calc closes.
9. MasterApp waits for Calc.exe to close, then displays the report to
the user.

The real issue here is performance. It's taking way too long to load
everything that's need into memory to run each time (JIT, etc.) and
then close everything back down EVERY time the user runs a report. I'd
like somehow, once the system is run the first time, for it to stay in
memory so that the user does not experience the load time lag every
single time they run a report.

As a note, loading the assemblies into the GAC doesn't appear to help.

I'll go ahead and apologize up front, because I am not certain that i'm
using the correct terminology to describe the issue i'm trying to
resolve.

Thanks in advance for any help/advice you can give.

- Carl

Nov 17 '05 #1
28 2036
I'm not sure I understand the choice of architecture here ...

Is there a NEED for calc.exe to be a command window application?
Can't you package your business logic (i.e.calc.exe) in a dll and call from
a web service, or package as a COM+ application, etc.
--
Of all words of tongue and pen, the saddest are: "It might have been"

Bill.Richards @ greyskin .co .uk
http://greyskin.co.uk
"ca******@gmail.com" wrote:
I need a way for my console application to stay running and be able to
be called at any time with some parameters, do it's work, then wait to
be called again, repeat.

Here's the details:

I have a C# engine that's used to run a lot of complex financial
calculations and return a report based upon the calculated results. My
program is called by another program... let's just call it "MasterApp"
and i'll call my program "Calc". Calc is the console app exe.

Here's the basic process:
1. User inputs some data into MasterApp.
2. User clicks tells MasterApp to "Go".
3. MasterApp writes out an xml file, then launches "Calc.exe"
4. Calc reads the xml to create the inputs that it understands
(there's some translation there).
5. Calc calls some of it's own dlls (C#), etc. with the translated
inputs.
6. The "guts" of calc.exe (the dlls which are called) take the inputs,
pull the data it needs, calculates and returns a report.
7. The report is written to a directory specified as a paramater to
the calc.exe call.
8. Calc closes.
9. MasterApp waits for Calc.exe to close, then displays the report to
the user.

The real issue here is performance. It's taking way too long to load
everything that's need into memory to run each time (JIT, etc.) and
then close everything back down EVERY time the user runs a report. I'd
like somehow, once the system is run the first time, for it to stay in
memory so that the user does not experience the load time lag every
single time they run a report.

As a note, loading the assemblies into the GAC doesn't appear to help.

I'll go ahead and apologize up front, because I am not certain that i'm
using the correct terminology to describe the issue i'm trying to
resolve.

Thanks in advance for any help/advice you can give.

- Carl

Nov 17 '05 #2
I'm not sure I understand the choice of architecture here ...

Is there a NEED for calc.exe to be a command window application?
Can't you package your business logic (i.e.calc.exe) in a dll and call from
a web service, or package as a COM+ application, etc.
--
Of all words of tongue and pen, the saddest are: "It might have been"

Bill.Richards @ greyskin .co .uk
http://greyskin.co.uk
"ca******@gmail.com" wrote:
I need a way for my console application to stay running and be able to
be called at any time with some parameters, do it's work, then wait to
be called again, repeat.

Here's the details:

I have a C# engine that's used to run a lot of complex financial
calculations and return a report based upon the calculated results. My
program is called by another program... let's just call it "MasterApp"
and i'll call my program "Calc". Calc is the console app exe.

Here's the basic process:
1. User inputs some data into MasterApp.
2. User clicks tells MasterApp to "Go".
3. MasterApp writes out an xml file, then launches "Calc.exe"
4. Calc reads the xml to create the inputs that it understands
(there's some translation there).
5. Calc calls some of it's own dlls (C#), etc. with the translated
inputs.
6. The "guts" of calc.exe (the dlls which are called) take the inputs,
pull the data it needs, calculates and returns a report.
7. The report is written to a directory specified as a paramater to
the calc.exe call.
8. Calc closes.
9. MasterApp waits for Calc.exe to close, then displays the report to
the user.

The real issue here is performance. It's taking way too long to load
everything that's need into memory to run each time (JIT, etc.) and
then close everything back down EVERY time the user runs a report. I'd
like somehow, once the system is run the first time, for it to stay in
memory so that the user does not experience the load time lag every
single time they run a report.

As a note, loading the assemblies into the GAC doesn't appear to help.

I'll go ahead and apologize up front, because I am not certain that i'm
using the correct terminology to describe the issue i'm trying to
resolve.

Thanks in advance for any help/advice you can give.

- Carl

Nov 17 '05 #3
Sorry, I should have clarified things a little better....

Calc.exe is really a wrapper around our existing core business and
calculations logic (which exists in a series of C# dll assemblies).

The whole thing is a stand alone desktop application, so a web service
wouldn't work. All of our code is C#, so i'm not sure how/if a COM+
app would work.

The MasterApp program will only communicate with an exe. MasterApp
writes its output to a directory, calls calc.exe with a couple of
command line parameters (location of its output, etc), then waits for
calc.exe to exit.

I hope i've answered your questions.

I great appreciate your response.
- Carl.

Nov 17 '05 #4
Sorry, I should have clarified things a little better....

Calc.exe is really a wrapper around our existing core business and
calculations logic (which exists in a series of C# dll assemblies).

The whole thing is a stand alone desktop application, so a web service
wouldn't work. All of our code is C#, so i'm not sure how/if a COM+
app would work.

The MasterApp program will only communicate with an exe. MasterApp
writes its output to a directory, calls calc.exe with a couple of
command line parameters (location of its output, etc), then waits for
calc.exe to exit.

I hope i've answered your questions.

I great appreciate your response.
- Carl.

Nov 17 '05 #5

"C_Bone" <ca******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Sorry, I should have clarified things a little better....

Calc.exe is really a wrapper around our existing core business and
calculations logic (which exists in a series of C# dll assemblies).

The whole thing is a stand alone desktop application, so a web service
wouldn't work. All of our code is C#, so i'm not sure how/if a COM+
app would work.

The MasterApp program will only communicate with an exe. MasterApp
writes its output to a directory, calls calc.exe with a couple of
command line parameters (location of its output, etc), then waits for
calc.exe to exit.

I hope i've answered your questions.

I great appreciate your response.
- Carl.


I would suggest in-proc remoting, that is, let the master application create
a separate Application Domain (AD) that handles the core business (so
you'll have to load the assemblies in that domain). The master application
can pass the XML as an argument in a (asynchronous) remoting call that
starts the business process, let the 'report' be the return 'value' of the
call, or use a call-back when done.

Willy.

Nov 17 '05 #6

"C_Bone" <ca******@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Sorry, I should have clarified things a little better....

Calc.exe is really a wrapper around our existing core business and
calculations logic (which exists in a series of C# dll assemblies).

The whole thing is a stand alone desktop application, so a web service
wouldn't work. All of our code is C#, so i'm not sure how/if a COM+
app would work.

The MasterApp program will only communicate with an exe. MasterApp
writes its output to a directory, calls calc.exe with a couple of
command line parameters (location of its output, etc), then waits for
calc.exe to exit.

I hope i've answered your questions.

I great appreciate your response.
- Carl.


I would suggest in-proc remoting, that is, let the master application create
a separate Application Domain (AD) that handles the core business (so
you'll have to load the assemblies in that domain). The master application
can pass the XML as an argument in a (asynchronous) remoting call that
starts the business process, let the 'report' be the return 'value' of the
call, or use a call-back when done.

Willy.

Nov 17 '05 #7
Well, the problem with that is the MasterApp is a 3rd party application
over which I have no control. They will ONLY interact with my app in
the way in which I have described.

Thanks,
Carl

Nov 17 '05 #8
Well, the problem with that is the MasterApp is a 3rd party application
over which I have no control. They will ONLY interact with my app in
the way in which I have described.

Thanks,
Carl

Nov 17 '05 #9

"C_Bone" <ca******@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Well, the problem with that is the MasterApp is a 3rd party application
over which I have no control. They will ONLY interact with my app in
the way in which I have described.

Thanks,
Carl


Well, I'm afraid you're stuck, the master application starts a new calc.exe
for each report, so your calc.exe has to start all over again, there is
nothing that can be left in memory once a process has terminated.

Willy.
Nov 17 '05 #10

"C_Bone" <ca******@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Well, the problem with that is the MasterApp is a 3rd party application
over which I have no control. They will ONLY interact with my app in
the way in which I have described.

Thanks,
Carl


Well, I'm afraid you're stuck, the master application starts a new calc.exe
for each report, so your calc.exe has to start all over again, there is
nothing that can be left in memory once a process has terminated.

Willy.
Nov 17 '05 #11
Let's pretend for a second that I put *another* exe in between the two
apps... call it "CalcWrapper.exe".

If MasterApp.exe calls CalcWrapper (which in turn calls calc.exe),
would it then be possible to do what i'm thinking and have Calc.exe
stay running as described above?

Nov 17 '05 #12
Let's pretend for a second that I put *another* exe in between the two
apps... call it "CalcWrapper.exe".

If MasterApp.exe calls CalcWrapper (which in turn calls calc.exe),
would it then be possible to do what i'm thinking and have Calc.exe
stay running as described above?

Nov 17 '05 #13
C_Bone wrote:
Well, the problem with that is the MasterApp is a 3rd party
application over which I have no control. They will ONLY interact
with my app in the way in which I have described.

Thanks,
Carl


Is it possible to break your application into two pieces? One that the 3rd
party app calls, and one that actually runs the calculations? The one the
app calls would communicate to the other one via some protocol (TCP,
perhaps), and the other could stay running?

The only problem would be if the amount of data that's communicated between
the two is large.

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
Nov 17 '05 #14
C_Bone wrote:
Well, the problem with that is the MasterApp is a 3rd party
application over which I have no control. They will ONLY interact
with my app in the way in which I have described.

Thanks,
Carl


Is it possible to break your application into two pieces? One that the 3rd
party app calls, and one that actually runs the calculations? The one the
app calls would communicate to the other one via some protocol (TCP,
perhaps), and the other could stay running?

The only problem would be if the amount of data that's communicated between
the two is large.

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
Nov 17 '05 #15
Yes, it would be possible to do that.... the data sent between the two
wouldn't be very large.

So are you saying have them communicate via TCP when all of the
applications, etc. are on one machine?

Nov 17 '05 #16
Yes, it would be possible to do that.... the data sent between the two
wouldn't be very large.

So are you saying have them communicate via TCP when all of the
applications, etc. are on one machine?

Nov 17 '05 #17
No, I think you would make matters worse.
As Willy has already told you, you're stuck.

What you are doing is not recommended. It's not 'Process Delegation' or
'PolyProcessing' or anything with a cool name; it's simply process-trashing
and Windows was not built for that kinda treatment. Sorry...

Happy Coding
- Michael S

"C_Bone" <ca******@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Let's pretend for a second that I put *another* exe in between the two
apps... call it "CalcWrapper.exe".

If MasterApp.exe calls CalcWrapper (which in turn calls calc.exe),
would it then be possible to do what i'm thinking and have Calc.exe
stay running as described above?

Nov 17 '05 #18
No, I think you would make matters worse.
As Willy has already told you, you're stuck.

What you are doing is not recommended. It's not 'Process Delegation' or
'PolyProcessing' or anything with a cool name; it's simply process-trashing
and Windows was not built for that kinda treatment. Sorry...

Happy Coding
- Michael S

"C_Bone" <ca******@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Let's pretend for a second that I put *another* exe in between the two
apps... call it "CalcWrapper.exe".

If MasterApp.exe calls CalcWrapper (which in turn calls calc.exe),
would it then be possible to do what i'm thinking and have Calc.exe
stay running as described above?

Nov 17 '05 #19

"C_Bone" <ca******@gmail.com> wrote in message
news:11********************@g47g2000cwa.googlegrou ps.com...
Yes, it would be possible to do that.... the data sent between the two
wouldn't be very large.

So are you saying have them communicate via TCP when all of the
applications, etc. are on one machine?


Have CalcWrapper.exe call a Windows Service?

Mythran

Nov 17 '05 #20

"C_Bone" <ca******@gmail.com> wrote in message
news:11********************@g47g2000cwa.googlegrou ps.com...
Yes, it would be possible to do that.... the data sent between the two
wouldn't be very large.

So are you saying have them communicate via TCP when all of the
applications, etc. are on one machine?


Have CalcWrapper.exe call a Windows Service?

Mythran

Nov 17 '05 #21
C_Bone wrote:
Yes, it would be possible to do that.... the data sent between the two
wouldn't be very large.

So are you saying have them communicate via TCP when all of the
applications, etc. are on one machine?


Sure.

Though, TCP may not be the best choice. I would recommend it if you had
some experience with it, but if you don't have any particular knowledge of
TCP, you could be better served going with something else.

Perhaps remoting because of it's object oriented nature? Perhaps shared
memory because it would be very fast?

TCP is a good fallback though, as it allows you a bit of flexibility if you
need it for the future.

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
Nov 17 '05 #22
C_Bone wrote:
Yes, it would be possible to do that.... the data sent between the two
wouldn't be very large.

So are you saying have them communicate via TCP when all of the
applications, etc. are on one machine?


Sure.

Though, TCP may not be the best choice. I would recommend it if you had
some experience with it, but if you don't have any particular knowledge of
TCP, you could be better served going with something else.

Perhaps remoting because of it's object oriented nature? Perhaps shared
memory because it would be very fast?

TCP is a good fallback though, as it allows you a bit of flexibility if you
need it for the future.

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
Nov 17 '05 #23

"C_Bone" <ca******@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Let's pretend for a second that I put *another* exe in between the two
apps... call it "CalcWrapper.exe".

If MasterApp.exe calls CalcWrapper (which in turn calls calc.exe),
would it then be possible to do what i'm thinking and have Calc.exe
stay running as described above?


Like Michael said, it probably will make things worse. The reason you want
to keep your business process alive is to eliminate the "start-up cost",
that makes me think that the actual "service time" is small and you think
the start-up time takes a considerable amount of the total processing time.
If that's the case you won't see any gain because now you will waste your
time by starting a middleman and by passing the XML stream to yet another
process.

Willy.
Nov 17 '05 #24

"C_Bone" <ca******@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Let's pretend for a second that I put *another* exe in between the two
apps... call it "CalcWrapper.exe".

If MasterApp.exe calls CalcWrapper (which in turn calls calc.exe),
would it then be possible to do what i'm thinking and have Calc.exe
stay running as described above?


Like Michael said, it probably will make things worse. The reason you want
to keep your business process alive is to eliminate the "start-up cost",
that makes me think that the actual "service time" is small and you think
the start-up time takes a considerable amount of the total processing time.
If that's the case you won't see any gain because now you will waste your
time by starting a middleman and by passing the XML stream to yet another
process.

Willy.
Nov 17 '05 #25
Willy, you nailed it as far as performance.

The start-up time of the app is a large percentage of the total time.
The service time is actually pretty fast.

Nov 17 '05 #26
Willy, you nailed it as far as performance.

The start-up time of the app is a large percentage of the total time.
The service time is actually pretty fast.

Nov 17 '05 #27
Michael S wrote:
No, I think you would make matters worse.
As Willy has already told you, you're stuck.

What you are doing is not recommended. It's not 'Process Delegation'
or 'PolyProcessing' or anything with a cool name; it's simply
process-trashing and Windows was not built for that kinda treatment.
Sorry...


I can't say that I agree with that. Although it is most unfortunate that
the Master program in his work expects things to operate in a Unix-like way
(start process, do work, terminate), adding a stable process "in the back
end" isn't going to cause the problem you suggest... he already has that
problem because of the way the Master program is working.

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
Nov 17 '05 #28
Michael S wrote:
No, I think you would make matters worse.
As Willy has already told you, you're stuck.

What you are doing is not recommended. It's not 'Process Delegation'
or 'PolyProcessing' or anything with a cool name; it's simply
process-trashing and Windows was not built for that kinda treatment.
Sorry...


I can't say that I agree with that. Although it is most unfortunate that
the Master program in his work expects things to operate in a Unix-like way
(start process, do work, terminate), adding a stable process "in the back
end" isn't going to cause the problem you suggest... he already has that
problem because of the way the Master program is working.

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
Nov 17 '05 #29

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

Similar topics

2
3733
by: Adrian Parker | last post by:
For some reason when I call validateFields before .Update (see below), I get this error: "Consumer's even handler called a non-reentrant method in the provider" However if I comment out the...
0
729
by: Martin B | last post by:
Hallo to everyone! Problem: -------- GridView Exception: reentrant call to the SetCurrentCellAddressCore function System: ------- WinXP Professional, english, .NET Framework 2.0 Beta...
6
11028
by: junky_fellow | last post by:
what are reentrant functions? What are the characteristics of a reentrant code ? what things should be kept in mind while writing a reentrant code ?
0
288
by: carlbono | last post by:
I need a way for my console application to stay running and be able to be called at any time with some parameters, do it's work, then wait to be called again, repeat. Here's the details: I...
2
2831
by: TheOne | last post by:
Would anyone please point me to a list of reentrant GNU C/C++ library functions? I have searched a lot on the web for it but without any success. Man page of signal(2) has listed system calls...
9
8278
by: TheOne | last post by:
Would anyone please point me to a list of reentrant C library functions? I want to know which C library functions are safe to use inside a signal handler across all platforms. Does GNU C library...
1
2730
by: jj_online | last post by:
This is not a C++ specific issue. However, I am trying to implement a readwritelock in C++ and hence would like to get help from this group. a readwritelock allows shared lock among all readers...
17
3230
by: fmassei | last post by:
Dear all, I'm trying to put some old code in a portable, cross-platform library and I'm facing a big problem: is there a standard, platform- independent way to write a reentrant function that...
12
3452
by: Bit Byte | last post by:
I am modifying some legacy code, to make the functions reentrant. I use lots of global data (large nested structs) to pass data around quicky. The global structures are far too large (in size) for...
0
7192
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7064
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
7261
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,...
1
6974
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
7445
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...
1
4991
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
4665
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...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.