ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

handling parallel submit jobs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • handling parallel submit jobs

    Hi, I test some procedure which reads and updates record, so I have chains with locks.
    I start many sumbit jobs and I see that in queue that waiting jobs have status LCKW instead of running parallel. So after first job finishes, second starts etc.
    How can I handle this to make them run parallel ?

  • #2
    Re: handling parallel submit jobs

    have different jobs run in different JobQues, or make it multi-threaded (which might screw up other things.)
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: handling parallel submit jobs

      Probably change the way you manage the records? read with no locks and then update with lock and release locks as soon as possible. The lock condition should be managed within your program in case it happens so that it is not hanging around.

      Chris...

      Comment


      • #4
        Re: handling parallel submit jobs

        Originally posted by michal2442
        ... and I see that in queue that waiting jobs have status LCKW instead of running parallel.
        Just for clarification, a job in a queue (a job queue, *JOBQ) will not have any locks at all. So I assume you mean that one (or more) of the submitted jobs has left the queue and is running in the associated subsystem.

        A number of possibilities can be involved with a LCKW status. We need to know more about it.

        If the job that does the SBMJOB commands is CHAINing to a record and locking the record, and then it issues a SBMJOB that needs to access the same record, you need to release the lock in the first job. Or you might use CHAIN(N) in your first job so that the record isn't locked in the first place. You can release a record lock by CHAINing to a different record or by running any UPDATE that is needed. The lock will remain in place until your program releases it (or the job or activation group ends and automatically releases locks).

        Does the first job UPDATE the record? If not, then you shouldn't have the program lock the record. Does the first job open the file as 'U'pdate or as 'I'nput?

        Are the submitted jobs all active with LCKW status? Or is only one job active while the others are still waiting in the job queue? Do you want all submitted jobs to run at the same time?

        Is the first job or the submitted job locking the whole file exclusively? Or is the lock only for a single record? Are all submitted jobs trying to access the same record? Are they UPDATEing the records or only trying to READ it? (We need to know what a lock is trying to do before we can know what to do about it.)
        Tom

        There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

        Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

        Comment


        • #5
          Re: handling parallel submit jobs

          Yes, 5 submitted jobs left the queue and 1 is running, 4 have LCKW status, until 1 is done. Every job needs access to the same record (exactly 2 records, taking number from range and then UPDATEs PF with actual value of number). So when I need to read sth I use CHAIN(n), but there are 3 UPDATE operations, so I use CHAIN.

          All submitted jobs are active with LCKW status, I wanna run all submitted jobs run at the same time. For test I use loop with 1000 operations of taking number (in every of 5 jobs), and I write them to some PF to see which job is taking number, and I see that first job is takin 1000 numbers, then second, third,... Jobs are'nt doing this at the same time, they wait with LCKW.


          'Is the first job or the submitted job locking the whole file exclusively? Or is the lock only for a single record?'
          I dont know this, where to find it? I guess that whole file (because under WRKJOBLCK I see file name), but Im not sure

          Comment

          Working...
          X