Learning Mechanisms Enabling Perfect Time-sharing in Dual Tasks