complete coding of buffer_manager, without debugging