Question about the sqlexec process and forks
Posted in 1992
Path: emory!wupost!cs.utexas.edu!tamsun!mtecv2!netnews From: alfonso@mtecv2.mty.itesm.mx Newsgroups: comp.unix.questions,comp.unix.programmer,comp.unix.misc,comp.unix.aix,comp.databases.informix Message-ID: <5302@mtecv2.mty.itesm.mx> Date: 7 Mar 92 01:02:09 GMT Sender: netnews@mtecv2.mty.itesm.mx Reply-To: alfonso@mtecv2.mty.itesm.mx Hi! I'm running my applications on a IBM/RS-6000 under AIX 3.1.5 using Informix OnLine. I'm going to explain the nature of my app so that you can understand my doubt and help me if you can: My application is a query resolver, its purpose its to look for books with characteristics that match the user's query. The structure of my database is complex, cause I need an efficient way of retrieving the information requested. What kind of queries? Why do I need so complex a structure for the database? The reason resides in the type of queries that the user can issue: They can ask for the books that contain certain word or beginning of word in their title, author or subjects: For instance: Look for all the books with the word "Isaac" in their author and the word "Asimov" in their author and the word "Robots" in their title. This query will provide me with the names of the books by Isaac Asimov that in their titles appear the word "Robots". OK? Well my database is not in fact the problem. Let's move to the next feature of my application: it uses the client-server approach. The server is running on the RS-6000, it's written almost entirely in C language and uses some routines writen in Informix 4gl to access the database. The SQL instructions that I use are few, the AND's and OR's and the AND NOT's operations are done in dynamic memory. The client side is writen in PET, a propietary language developed here in the university (ITESM) that it's C-like, uses windowing and Sun RPC's (remote procedure calls) to communicate with the server. At present PET can be run only on PC's and compatibles, but a newer version called ALFIL will be released soon and will run on Windows, Motif, Macintosh and other windowing systems, but let's go back to my app. In my app, in the client side, the user issues a query and the client generates a P-Code that is sent to the server. This P-Code is interpreted in the server and its execution causes the user's query to be resolved. The server then returns the results to the client and the client displays them. Sounds complicated????? Well, its all done now and it works fine. Next feature: The server uses fork in order to create child processes that help him in the resolution of queries and thus give a better response time. What does the server do? First, when it is initiated, it access the database to obtain some data and then creates some tables in dynamic memory. By this time, an sqlexec process is created for the server. My server is ready to receive requests, when one arrivs, it forks and the chlld process assists the request and communicates the results to the client. Meanwhile the parent process can continue receiving requests, forking each time. My problem? As you know, every process belongs to a process group. All the child processes belong to their parent process group. I'm not sure, but I believe that the sqlexec process that is created to asist a process with the database belongs to the same process group, so it is created only once, therefore the child processes and the parent process share the same sqlexec process, so when concurrent queries are run and there are multiple child processes running, the sqlexec process confuses and sends the sql results to the wrong processes, making them to issue a "Invalid message type receive from sqlexec process" message and aborting. Am I right in my ideas? Or there's a way to fix my problem? Alfonso Trevino