If processor Pihas the token and Pi is idle, it passes the token to Pi+1. If Pi is red, then the color of the token is set to red before it is sent to Pi+1. If Pi is green, the token is passed unchanged.
After Pi passes the token to Pi+1, Pi becomes green .
The algorithm terminates when processor P0receives a green token and is itself idle.