On Wed, 23 Jan 2008 00:28:42 +0100, Lindy Mayfield wrote: >Would you mind, Paul, giving a couple of examples of real life programs >that you are thinking about? > With apologies: It's been decades since I did it; the language was not Assembler but Pascal; it would be difficult or impossible to find the source code.
I was simply single-threading one critical resource with a lock managed by CS. If the resource was available, the lock word was 0; if busy, the address of an ECB to post when it was freed. The details are lost. >I know personally that I couldn't get my head around this stuff unless I >imagined some sort of application and how it would work using threads. > >Three things came to mind: How does DB2 do it? What would an HTTP >server do? What about sort that divides the work among different >threads? > DB2 is a mystery. MySQL is open-source, but likely does not use WAIT and POST. HTTPD could just ATTACH a task for each connection (surely Apache uses fork() instead). The supervisor task needs only to WAIT on ECBs in order to DETACH the children when they terminate. >In my imaginings the total number of "structures" to handle was >something like TotalThreads=N*Cpu_count, but was always fixed at any >given time. > I would have expected that sort would be I/O bound rather than compute bound, and gain little by using multiple CPUs. But I may be very wrong. I understand that neither CICS nor JES uses WAIT and POST for its subprocesses, each relying on an idiosyncratic dispatching mechanism. I would expect each would WAIT when completely idle, to relinquish the CPU to other jobs. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

