IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 25, 2009, 11:56:09 AM (17 years ago)
Author:
eugene
Message:

upgrade threading/locking model for pantasks: changes merged from eam_branch_20090322

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pantasks/notes.txt

    r7892 r23530  
     1
     2stdout_cntl:
     3  GetJobOutout
     4    CheckControllerJob
     5      CheckController
     6        controller_threads (controlThread)
     7  StartController
     8  ControllerCommand
     9    CheckController
     10      controller_threads (controlThread)
     11    controller_check (clientThread)
     12    controller_host (clientThread)
     13    controller_jobstack (clientThread)
     14    controller_run (clientThread)
     15    controller_status (clientThread)
     16    controller_verbose (clientThread)
     17    DeleteControllerJob
     18      CheckControllerJob
     19        CheckController
     20          controller_threads (controlThread)
     21    CheckControllerJobStatus
     22      CheckControllerJob
     23        CheckController
     24          controller_threads (controlThread)
     25    SubmitControllerJob
     26      SubmitJob
     27        CheckTasks (JobTaskThread)
     28    PrintControllerBusyJobs
     29    KillControllerJob
     30    QuitController
     31    RestartController   
     32  CheckControllerOutput
     33    controller_output (clientThread)
     34    controller_threads (controlThread)
     35
     36
     37
     38
     39
     40
     41
     4220090322
     43
     44  We've been surviving with a slightly broken threading / locking
     45  model.  I would like to clean it up.  Previously, the threads where
     46  blocking at a very coarse level, and there were certain interactions
     47  that were not thread-safe.  Here are my notes on re-working this:
     48
     49  * we have 6 threads:
     50
     51    * main (top-level parent) : after it spawns the 5 child threads,
     52      this thread waits for new clients and adds them to the list of
     53      active clients with 'AddNewClient'
     54
     55    * clientsThread (ListenClients): this thread is listening for
     56      commands from the clients; when it receives a complete command,
     57      it executes the command using 'multicommand'.
     58
     59    * tasksThread
     60      CheckTasks
     61        NextTask
     62
     63
     64
     65    * jobsThread
     66
     67    * controllerThread
     68      CheckControllerStatus : race condition is irrelevant
     69
     70    * inputsThread
     71      AddNewInput called by clientThread
     72      (not sure this is really being used:
     73           server input (filename) calls 'input'
     74           server module (filename) calls 'module'
     75
     76  * functions which need to be thread-safe:
     77    * AddNewClient
     78    * gprint and supporting functions must be thread safe (extensively
     79      used...)
     80
     81
     82* race condition is irrelevant for this variable
     83static int ControllerStatus = FALSE;
     84
     85static int stdin_cntl, stdout_cntl, stderr_cntl;
     86GetJobOutput -> CheckControllerJob -> CheckController -> controllerThread
     87ControllerCommand -> controllerThread / clientThread
     88CheckControllerOutput -> controllerThread / clientThread
     89StartController -> controllerThread / clientThread
     90StopController
     91
     92
     93
     94static IOBuffer stdout_buffer;
     95static IOBuffer stderr_buffer;
     96static int ControllerPID = 0;
     97
     98/* local static variables to track the controller host properties */
     99static Host *hosts = NULL;
     100static int Nhosts = 0;
     101static int NHOSTS = 0;
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
    1125
    2126PanTasks Client / Server design
Note: See TracChangeset for help on using the changeset viewer.