You probably want to at least find the first live pid in the queue here. If the first is dead, check next one.