[GHC] #15193: QSem makes nonsense claim

#15193: QSem makes nonsense claim -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Core | Version: 8.2.2 Libraries | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Documentation Unknown/Multiple | bug Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- It says waiting threads are serviced in FIFO order. This isn't really a meaningful statement. What does "first in" mean? Furthermore, the first step in `waitQSem` is `takeMVar`, which provides no ordering guarantees whatsoever. As far as I can tell, there's no meaningful difference between a thread waiting a long time in the queue and I've waiting a long time to get into the queue. So I think we probably want to weaken the promise here to match the `MVar` fairness guarantee: if a thread waits on a `TSem`, and that `TSem` continues to be signaled, then the thread will eventually proceed. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15193 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15193: QSem makes nonsense claim -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by dfeuer: Old description:
It says waiting threads are serviced in FIFO order. This isn't really a meaningful statement. What does "first in" mean? Furthermore, the first step in `waitQSem` is `takeMVar`, which provides no ordering guarantees whatsoever. As far as I can tell, there's no meaningful difference between a thread waiting a long time in the queue and I've waiting a long time to get into the queue. So I think we probably want to weaken the promise here to match the `MVar` fairness guarantee: if a thread waits on a `TSem`, and that `TSem` continues to be signaled, then the thread will eventually proceed.
New description: It says waiting threads are serviced in FIFO order. This isn't really a meaningful statement. What does "first in" mean? Furthermore, the first step in `waitQSem` is `takeMVar`, which provides no ordering guarantees whatsoever. As far as I can tell, there's no meaningful difference between a thread waiting a long time in the queue and one waiting a long time to get into the queue. So I think we probably want to weaken the promise here to match the `MVar` fairness guarantee: if a thread waits on a `TSem`, and that `TSem` continues to be signaled, then the thread will eventually proceed. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15193#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15193: QSem makes nonsense claim -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonmar): `takeMVar` does serve threads in FIFO order, although the semantics doesn't require it. I think we'd be unlikely to ever break this property, because I suspect there are things depending on it (like `QSem`). What is it about "first in" with respect to QSem that's problematic? What does `TSem` have to do with this? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15193#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15193: QSem makes nonsense claim -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by dfeuer: Old description:
It says waiting threads are serviced in FIFO order. This isn't really a meaningful statement. What does "first in" mean? Furthermore, the first step in `waitQSem` is `takeMVar`, which provides no ordering guarantees whatsoever. As far as I can tell, there's no meaningful difference between a thread waiting a long time in the queue and one waiting a long time to get into the queue. So I think we probably want to weaken the promise here to match the `MVar` fairness guarantee: if a thread waits on a `TSem`, and that `TSem` continues to be signaled, then the thread will eventually proceed.
New description: It says waiting threads are serviced in FIFO order. This isn't really a meaningful statement. What does "first in" mean? Furthermore, the first step in `waitQSem` is `takeMVar`, which provides no ordering guarantees whatsoever. As far as I can tell, there's no meaningful difference between a thread waiting a long time in the queue and one waiting a long time to get into the queue. So I think we probably want to weaken the promise here to match the `MVar` fairness guarantee: if a thread waits on a `QSem`, and that `QSem` continues to be signaled, then the thread will eventually proceed. -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15193#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15193: QSem makes nonsense claim -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): `TSem` was not what I meant to write. The trouble with "first in" is that it's hard to say what happens "first" in a concurrent setting. If I create ten threads, each of which immediately waits on an empty `QSem`, then later signal that `QSem` several times, it's totally arbitrary which threads get serviced when. It seems the guarantee must have to do with consecutive requests by the same thread, with some guarantees about thread creation. Or something... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15193#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15193: QSem makes nonsense claim -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Core Libraries | Version: 8.2.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonmar): "first in" has a perfectly reasonable meaning: the execution of the program corresponds to some unspecified interleaving that sequentialises the operations, and you can define first-in using that ordering. Yes you can construct programs where the ordering is non-deterministic, but you can also construct programs where the ordering is deterministic, and in those cases the FIFO ordering property is useful to the programmer. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15193#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC