NSOperation for multiple small pipelines?

  • If I have a program that can create multiple small pipelines of
    arbitrary length, would NSOperation be effective for distributing the
    processes among several threads?  A useful answer for me would be
    "Yes, just study the documentation" or "no, it won't solve the problem."

    If I have one pipeline, A-B-C, then process A would put data into a
    queue for process B, which would put data into a queue for process C.
    If only one thread were available, I would want it to completely
    execute process A, then completely execute process B, etc.  If three
    threads were available, I would want each process to be assigned to a
    different thread.  If one of the processes crashes, then it needs to
    cause the other processes in that pipeline to gracefully terminate.

    Then lets say I have three pipelines, A-B-C, I-J-K and X-Y-Z.  If
    three threads were available, then they could possibly be assigned to
    processes A, B and C, or possibly to A, I, and X.  If more threads
    were available then they should be assigned to processes that are
    likely to have available data.  In the case where processes A, I and X
    are active, then processes likely to have data would be processes B, J
    and Y.

    I'm assuming from what I read before Leopard was released that
    NSOperation could be informed that process B was dependent on process
    A.  So does that mean that NSOperation will not begin process B until
    after process A has finished?  Or will NSOperation be able to begin
    process B after process A has begun and allow them both to operate
    concurrently?  Are there implications for how I have to put locks on
    the queues?

    My present implementation just causes a thread to be created for every
    process, but now I understand that the new way to approach the problem
    is to use NSOperation and allow it to decide how many threads should
    actually be created.

    Any thoughts?
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today