homework3: protect cout by mutex in binary read/write methods