Ticket #2319 (closed merge: fixed)

Opened 5 years ago

Last modified 5 years ago

STM not as fair as it could be

Reported by: josef Owned by: igloo
Priority: normal Milestone: 6.10.1
Component: Runtime System Version: 6.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

Even though this has been discussed via email I'm filing a ticket so that the issue and the patch aren't forgotten about. If the patch is accepted it would be nice if it could be included in 6.8.3 provided it merges cleanly.

GHC's STM implementation could be a bit more fair. Suppose you have several transactions waiting for a variable to be updated. When that variable is updated all transactions are woken up. The problem is that the transaction which was blocked last is woken up first. This leads to unnecessary starvation in some programs.

There is a patch which fixes this. It can be downloaded from here:  http://www.haskell.org/pipermail/cvs-ghc/2008-April/041943.html

Change History

Changed 5 years ago by igloo

  • difficulty set to Unknown
  • milestone set to 6.10 branch

Sorry, too late for 6.8.3, but let's try to take a look for 6.10.

Changed 5 years ago by simonmar

  • architecture changed from Multiple to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Multiple to Unknown/Multiple

Changed 5 years ago by josef

I'd really like for this patch to get into 6.10.1. Pretty please?

Changed 5 years ago by simonmar

  • owner set to igloo
  • type changed from bug to merge
  • milestone changed from 6.10 branch to 6.10.1

tested and pushed.

Fri Oct 10 16:03:22 BST 2008  Josef Svenningsson <josef.svenningsson@gmail.com>
  * When waking up thread blocked on TVars, wake oldest first (#2319)
  StgTVarWatchQueue contains the threads blocked on a TVar in order 
  youngest first. The list has to be traversed backwards to unpark the threads 
  oldest first.
  
  This improves the fairness when using STM in some situations.

Changed 5 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

Merged.

Note: See TracTickets for help on using tickets.