Distributed random access algorithm: scheduling and congestion control