I am already using this technique of DTAQs but I was wondering about
threading within RPGLE. As I can see these threads within a JOB.

On Thu, Apr 23, 2020 at 12:33 PM Charles Wilt <charles.wilt@xxxxxxxxx>
wrote:

It's possible, but the main reason for using threads on other platforms,
namely that context switching between processes (jobs) is expensive,
doesn't apply to the IBM i.

The way we handle things is RPG program put requests on a data queue, a
never ending service job, picks up the request and handles it, and puts a
response (if needed) onto another data queue.

If the queue starts backing up, simply start more queue processing jobs.

We built our own years ago, however Dieter Bender released an
opensource appserver4rpg project that basically does this for you.

Dieter is on these lists, I'm sure he'll jump in.

Charles

On Thu, Apr 23, 2020 at 11:15 AM Mohammad Tanveer <surgum@xxxxxxxxx>
wrote:

Yes JVM is active. I got it now.

Is there a way to make RPGLE (multi threading)?

My problem is that I have many jobs trying to use java and all of them
starting their own JVM. Starting JVM is taking CPU.

I was thinking to start one job which starts JVM and then rest of the
jobs
communicate to that program in separate threads to do java functions. Is
it possible on as/400 using RPGLE?



On Thu, Apr 23, 2020 at 11:57 AM Charles Wilt <charles.wilt@xxxxxxxxx>
wrote:

It would be very unusual for the RPG program to be using multiple
threads...

Much more likely, the RPG program is using Java to do something.

The JVM running in the job probably has all the additional threads.

If you look at the call stack of the threads, you'll likely to see J9
mentioned...
Type Program Statement Procedure

QLESPI QSYS 19
LE_Create_Thread2__FP12crtt >
QP0WPINT QSYS 19 pthread_create_part2

QP2USER2 QSYS 3 __Qp2Thread

QP2USER2 QSYS 5 runpase_common__FiPvT2

P unix *N

P libpthreads.a(shr_xpg > 000000FC _pthread_body

P libj9thr26.so 00000150 thread_wrapper

P libj9gc26.so 00000048 dispatcher_thread_proc

P libj9prt26.so 00000368 j9sig_protect

P libj9gc26.so 00000244
dispatcher_thread_proc2__FP >

Also from WRKJOB, look at option 45-Work with Java Virtual Machine, if
active

Charles

On Thu, Apr 23, 2020 at 9:59 AM Mohammad Tanveer <surgum@xxxxxxxxx>
wrote:

Can someone help me understand Threading on AS/400. I have this job
ITSYNC
it (CL program) reads data from a dataque and process it using RPGLE
program.
I see 83 active threads. Does this mean job can process 83 DTAQ
entries
simultaneously?

Job: ITSYNC User: BATCHORDER Number: 173290


Type options, press Enter.

3=Hold 4=End 5=Display attributes 6=Release 10=Display call
stack

11=Work with thread locks 14=Work with thread mutexes



Total Aux
Run
Opt Thread Name Status CPU I/O
Priority
0000004C DEQW 4.293 5563
30
000000B3 TIMW .021 203
30
000000A9 TIMW .633 34
30
000000A7 TIMW .001 8
30
000000A6 TIMW .002 11
30
000000A5 TIMW .002 10
30
000000A4 TIMW .002 11
30
000000A3 TIMW .002 11
30
000000A2 TIMW .002 13
30
000000A1 TIMW .001 0
30
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.