• (nodebb)

    With so many threads being spun off, the shirt will soon fall apart.

  • MaxiTB (unregistered)

    I'm confused, doesn't python have proper libraries to parallelize tasks?

  • Charles Shapiro (unregistered)

    I'm not very comfortable with multi-threading. But isn't this a thing that yield is designed to help?

  • Tim (unregistered) in reply to MaxiTB

    I'm sure it does, but the problem here is almost certainly that the person writing the code didn't think about the requirement and just piled in, initially writing some simple code that didn't work, gradually augmenting it using the Darwinian process until it worked well enough to pass a few test cases. This is a pretty standard design methodology for multi-threaded code as far as I can see.

  • Sauron (unregistered)

    The purpose of generating an infinite number of threads is obvious: twisting them as strands, themselves to be twisted as a rope, itself to be knotted as a noose. Those thread are the symbol of despair! Avoid them, lest your sanity gets sacrificed to Codethulhu!

  • (nodebb)

    Even without threading this code doesn't make any sense.

  • Gearhead (unregistered) in reply to Tim

    @Tim I agree with your theory -- programmer is inexperienced or uncurious and does a random walk through the code space. It is possible to do lock-free handshaking, and there is a place for it. But (a) compilers can reorder instructions, (b) processors can perform out-of-order execution, and (c) lock-free code is harder to get right, so needs more planning and documentation.

  • Jeremy (unregistered)

    The sad thing is that the author(s) of the code probably won't learn anything from this as they moved on.

    Having at most one thread per object would be a good start. Having threads expire themselves will only complicate things. Having a fixed definition for a task could be a good solution as well (why is it no longer doen after 1sec after finishing)

    I guess the task of having a good system design drowned in the background

Leave a comment on “Background Threads”

Log In or post as a guest

Replying to comment #:

« Return to Article