"Bad apple" algorithm, or process crashes shared sandbox

Posted by Roger Lipscombe on Programmers See other posts from Programmers or by Roger Lipscombe
Published on 2013-10-30T08:42:35Z Indexed on 2013/10/30 10:18 UTC
Read the original article Hit count: 246

Filed under:

I'm looking for an algorithm to handle the following problem, which I'm (for now) calling the "bad apple" algorithm.

The problem

  • I've got a N processes running in M sandboxes, where N >> M.
  • It's impractical to give each process its own sandbox.
  • At least one of those processes is badly-behaved, and is bringing down the entire sandbox, thus killing all of the other processes.

If it was a single badly-behaved process, then I could use a simple bisection to put half of the processes in one sandbox, and half in another sandbox, until I found the miscreant.

This could probably be extended by partitioning the set into more than two pieces until the badly-behaved process was found. For example, partitioning into 8 sets allows me to eliminate 7/8 of the search space at each step, and so on.

The question

If more than one process is badly-behaved -- including the possibility that they're all badly-behaved -- does this naive algorithm "work"? Is it guaranteed to work within some sensible bounds?

© Programmers or respective owner

Related posts about algorithms