Hi Yuvaraj,

I did hit this snag a few years ago and I did work-around this using the
following options.
1. Make a Windows service, mine is using C++ with ATL, which calls an
instance of J OLEAUTOMATION server every time I need to calculate.
Having 4 concurrent client may mean 4 or more instance of J sessions
running at the same time.
2. I use C# or VB.NET as the front end system and calls/executes J
scripts when needed. I can have 1 or more J session running in the
background depending on the need of the client. Actual real life
implementation of this only runs 1 instance of J at one time. The
instance is closed as soon as processing is done. The cool thing is that
the front end system built with VB.NET still looks likes it's working.
;)

You mentioned something about working with large amount of data. I was
able to make a real long operation (large data) faster by partitioning
my data into coherent atomic partitions. I basically chopped my data
into smaller pieces, made 5 calls to the Windows service handler and
waited for all the 5 calls to return. Then made a 6th call which just
consolidates the results. I also cheated a bit, instead of sending data
between the client and the windows service, I just made J connect
directly the MS-SQL server database and giving it a unique id (GUID) to
identify its data for retrieval and save. The first 5 calls saves the
data to a temporary table and the last call consolidates the results by
reading the data from the temp table and saving the data into the actual
target table.

You can use the following guides and technologies to get you on the
path:
http://www.jsoftware.com/jwiki/Guides/Windows_Progress_Dialog - how to
make a progress dialog using J
http://www.jsoftware.com/jwiki/DB - guides on using databases with J
http://www.jsoftware.com/jwiki/Interfaces - guides on using J from other
programming languages
http://www.zeroc.com/ - a faster replacement for JSockets. Believe me
... this is WAY-WAY-WAY faster than using pure J sockets when
transferring data from a J client to a J server or any programming
language over the network. 
http://www.jsoftware.com/jwiki/JWebServer - a J webserver which may be
usefull for you. :)

Good luck!

r/Alex

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dan Bron
Sent: Monday, March 24, 2008 10:59 PM
To: Programming forum
Subject: Re: [Jprogramming] Multi-threading in J?

> I was not able to locate any lab or description of multi-threaded
> programming in J/Win32 in my quick search.

J is single threaded.  You cannot create multiple threads in J.  

> In the User Documentation, there is the statement that for these
cases:
> "best designed from the ground up to have the GUI part in one
execution
> thread or task that is always responsive and the data processing part
in a
> separate thread or task." [1].

Funny, I never realized this statement was ambiguous if you didn't
already know what it was trying to tell you :)

What it's suggesting is that you embed J as a calculation engine in a
larger framework.  For example, you could build a .NET project with a C#
GUI for the frontend and the J dll or COM objects for the backend.

Another easy path would be to run two separate J processes (one for the
frontend, one for the backend), and have the communicate via sockets and
mapped files.

-Dan

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to