Design and Optimization of Resistive RAM-based Storage and Computing Systems