Windows and Unix (Sun and DecStation only!) shared memory

[sec:unixshared]

On Windows NT/Windows 95 and on some Unix systems (Sun and DecStations)work is currently in progress to implement the shared memory facility on all Unix systems it is possible to cimmunicate between processes using shared memory. In the histogram producer program, use routime HLIMAP instead of HLIMIT to initialize HBOOK. With PAW use the command GLOBAL to use shared memory.

                       +--------------------------+
                       |CALL  HLIMAP CHNAME,NWORDS |
                       +--------------------------+
                                  

Action: Creates a shared memory area.

Input parameters:
CHNAME
Character variable (CHARACTER*4) specifying the name given to the shared area.
NWORDS
Number of words for the shared area.

All histograms, Ntuples, etc. in this ara, which has a structure similar to the /PAWC/ common.

Using PAW and Unix shared memory (Sun and DecStation only)

[sec:unixpresenter]

      Program hserver
*
*     HBOOK program creating a "shared memory"
*     area called 'TEST'
*     Routine HLIMAP replaces HLIMIT.
*     NWORDS is the amount of space requested
*     in the shared area.
*
      parameter(nwords=50000)
      call hlimap(nwords,'TEST')
*
      call hbook1(1,'test1',100,-3.,3.,0.)
      call hcopy(1,2,'test2')
      call hcopy(1,3,'test3')
*
      do 10 i=1,100000000
         call rannor(a,b)
         call hf1(1,a,1.)
         call hf1(2,b,1.)
         call hf1(3,a**2+b**2,1.)
         if(mod(i,100000).eq.0)
     X   print *,' hserver in loop index ',i
  10  continue
*
      end
$ f77 -L... -l... -ohserver hserver.f
$ hserver
GLOBAL MEMORY CREATED,
        offset from LQ =  1037452510
 hserver in loop index   100000
 hserver in loop index   200000
 hserver in loop index   300000
 hserver in loop index   400000
 hserver in loop index   500000
 hserver in loop index   600000
 hserver in loop index   700000


    PAW > edit shared
        macro shared ntimes=100
        histo/plot 1 K
        do nt = 1,[ntimes]
           histo/plot 1 U
           wait ' ' 1
        enddo
        return
    PAW > global TEST
    PAW > exec shared ntimes=15


Figure: Visualise histograms in Unix shared memory

[fig:unixshared]

On Unix PAW can be used as an online presenter using the shared memory facility (at present on Sun and DecStation only) and the routines described in section [more info] Figure [more info] shows on the left hand side the program, which fills the histograms. It is compiled and linked with the f77 command, and then started. It writes the lines shown while going through the event loop. Then PAW is started, communication is established via the command global TEST, which declares that the area called 'MAP' is to be shared for data communication, and the execution of the KUMAC program shared.kumac, shown at the top right of the figure, is initiated.

The output shown on the screen then allows one to follow interactively (using the Update option 'U' of the plot command) how the event generator (the hserver program) fills histogram number one. The first fifteen iterations have been captured and are shown at the bottom right of Fig. [more info].