Algebraic semantics for total correctness and fairness