Changes between Version 104 and Version 105 of LightweightConcurrency


Ignore:
Timestamp:
May 23, 2012 5:27:40 AM (2 years ago)
Author:
kc
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LightweightConcurrency

    v104 v105  
    406406 * '''(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. 
    407407 * '''(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. 
     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. Here, the current thread is said to have `inherited` the thunk. 
    409409 * '''(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).  
    410410 * '''(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.