Shared Temp-table for Multiple threads

Project:4GL Thrown Exceptions
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi Folks,
I am creating(initiating) multiple threads using Unix/Progress.
What I want is some way to process each thread create some temp-table records and at the end of all the threads I have a master temp-table.

Problem is each thread is a seperate Progress session and kills the temp-table at the end of each session.

Details ......

One main program say xxxx0.P defines a new shared temp-table

And initiates 40 threads (each a different progress session).
It executes program xxxx1.p in each session
xxxx1.p has defines temp-table as shared.

At the end of all 40 threads ........
xxxx2.p is initiated and defines temp-table as shared.......
But it will not get any data that was created by each thread.

The only solution I have right now is to physically dump data in flat files from each session and than in xxxx2.p I convert all flat files into 1 file and create a temptable from that one flat file.

But this is a total waste and have to keep processing the same information again......

Anyone has a better way ........ Not sure the new datasets and all would help.....

I am using the latest Progress so datasets and all are no issue.

Thanks and Regards,
Samir Shah.


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tamhas's picture

#1

I would start by thinking of these as multiple processes instead of multiple threads, since they are completely separate and related only by history. Consequently, there really is no way to do anything like sharing a temp-table across sessions ... and, of course, shared temp-tables are evil anyway. You need to be thinking in terms of ways that totally separate sessions can interact. This includes things like sockets and named pipes, but given the focus on temp-tables, I suspect your best shot is going to be using a database. This could be a table for the purpose in your regular database or it could be a separate database with a special table in it for the purpose. Have the main process copy the database from an empty copy. If you want all sessions to talk to it at the same time, you will also have to start a server. If they can talk to it sequentially, then you can skip the server.


#2

Thanks Tamhas.

My focus is not on temp-table, I rather need a way to share information that was created in multiple progress sessions in parent session that created those sessions.

It doesn't have to be temp-tables.
using database is obvious. Any other ways to do it.

(I think if it was oracle I could have created a view and updated it from multiple sessions and then use it in parent session and than delete the view.)
Not sure what I can do for progress.....


tamhas's picture

#3

As I say, other ways include sockets and named pipes and, of course, trashy stuff like OS files, but sockets and pipes are better for a 2 way connection than an N-way connection.

There is also the issue of transactions. If one process finishes and another doesn't, do you want to save the results or throw them away.

And, you might want to lobby your salesperson for real multi-threading
http://www.oehive.org/MultiThread