A grinding machine for machining workpieces comprises a machine bed; a workpiece holder comprising a workpiece spindle; at least one grinding spindle comprising a grinding tool for machining; a set of steady rests spaced apart from each other along an axial longitudinal extension of the workpiece, wherein the steady rests are operable in an engagement state and a disengagement state, and wherein the steady rests of the set of steady rests are arranged to engage in the engagement state a workpiece for support, the workpiece being mounted on the workpiece holder; and a control device that is configured to selectively set the steady rests into the engagement state or the disengagement state in such a way that a change between the engagement state and the disengagement state takes place during the machining of the workpiece.