System Optimization for 3D-Stacking Memories