Changes between Version 102 and Version 103 of LightweightConcurrency

May 23, 2012 4:31:55 AM (5 years ago)



  • LightweightConcurrency

    v102 v103  
    404404Since each of these conditions can either be true or false, we have 8 cases to consider.
     406 * ''(1, 2) PTM(F)   UPT(F)   CCAP(T/F)'' - This is the typical case when a thread blocks on a black hole. Here, we enque the thread on the blackhole and perform the yieldControlAction to switch to another thread. When the thunk finishes evaluation, we examine the blocked threads. If a blocked thread is not an upcall thread, we know it has a scheduleSContAction, which is executed to resume the blocked thread.
     407 * ''(3, 4) PTM(F)   UPT(T)   CCAP(T/F)'' - This case cannot happen. Upcall threads only execute PTM actions.
     408 * ''(5, 6) PTM(T)   UPT(T/F) CCAP(T)''   - We are under PTM and potentially manipulating the scheduler. The blackhole is owned by a thread on current capability and is suspended. Hence, the only option is to force evaluation of the thunk. This is achieved by creating a closure (AP_STACK) that contains all of the frames from the blackhole owner thread until the update frame that corresponds to the blackholed thunk. Blackhole owner's stack is modified such that when it resumes, it evaluates the newly created closure instead of resuming the original thunk evaluation. Current thread evaluates the newly created thunk to force evaluation of the thunk. The current thread is said to have `inherited` the thunk.
     409 * ''(7)    PTM(T)   UPT(F)   CCAP(F)''   - A user-level thread under PTM has blocked on a blackhole owned by a thread on a different capability. We cannot inherit the computation. The solution is similar to (1).
     410 * ''(8)    PTM(T)   UPT(T)   CCAP(F)''   - This is a tricky case. Upcall thread blocks on a blackhole, which is owned by a thread on a different capability. We need to put the capability to sleep and wake-up when the black-holed thunk finishes evaluation. Here, we enque the upcall thread on the blackhole. Now, the current capability does not have any runnable threads. Hence, it goes to sleep. When the thunk finishes evaluation, we examine the blocked thread. Since the thread is an upcall thread, we push it on its owning capability. This implicitly wakes up the capability, which resumes execution. 
    408412=== Asynchronous Exceptions ===