summaryrefslogtreecommitdiff
path: root/rts/Threads.h
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-04-01 09:16:05 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-04-01 09:16:05 +0000
commitf4692220c7cbdadaa633f50eb2b30b59edb30183 (patch)
tree3d29f1b4770bedb7c69c31b2828f9b5acca3e2c3 /rts/Threads.h
parent7c4cb84efd774a21f11fb03118feb0434282ecf3 (diff)
downloadhaskell-f4692220c7cbdadaa633f50eb2b30b59edb30183.tar.gz
Change the representation of the MVar blocked queue
The list of threads blocked on an MVar is now represented as a list of separately allocated objects rather than being linked through the TSOs themselves. This lets us remove a TSO from the list in O(1) time rather than O(n) time, by marking the list object. Removing this linear component fixes some pathalogical performance cases where many threads were blocked on an MVar and became unreachable simultaneously (nofib/smp/threads007), or when sending an asynchronous exception to a TSO in a long list of thread blocked on an MVar. MVar performance has actually improved by a few percent as a result of this change, slightly to my surprise. This is the final cleanup in the sequence, which let me remove the old way of waking up threads (unblockOne(), MSG_WAKEUP) in favour of the new way (tryWakeupThread and MSG_TRY_WAKEUP, which is idempotent). It is now the case that only the Capability that owns a TSO may modify its state (well, almost), and this simplifies various things. More of the RTS is based on message-passing between Capabilities now.
Diffstat (limited to 'rts/Threads.h')
-rw-r--r--rts/Threads.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/rts/Threads.h b/rts/Threads.h
index 000cf1b8e2..e3680f2d50 100644
--- a/rts/Threads.h
+++ b/rts/Threads.h
@@ -19,6 +19,7 @@ StgTSO * unblockOne_ (Capability *cap, StgTSO *tso, rtsBool allow_migrate);
void checkBlockingQueues (Capability *cap, StgTSO *tso);
void wakeBlockingQueue (Capability *cap, StgBlockingQueue *bq);
void tryWakeupThread (Capability *cap, StgTSO *tso);
+void migrateThread (Capability *from, StgTSO *tso, Capability *to);
// Wakes up a thread on a Capability (probably a different Capability
// from the one held by the current Task).
@@ -32,8 +33,6 @@ void wakeupThreadOnCapability (Capability *cap,
void updateThunk (Capability *cap, StgTSO *tso,
StgClosure *thunk, StgClosure *val);
-void removeThreadFromMVarQueue (Capability *cap, StgMVar *mvar, StgTSO *tso);
-
rtsBool removeThreadFromQueue (Capability *cap, StgTSO **queue, StgTSO *tso);
rtsBool removeThreadFromDeQueue (Capability *cap, StgTSO **head, StgTSO **tail, StgTSO *tso);