The PoS (Proof of Service) code performs quality of service checks on the masternodes. The way I understand it then increments or decrements a score based on the results of it's checks. Masternode's with a higher score are performing more optimally.
Edit: that description might be a bit overly...