The main engine has its own control system for starting, reversing and speed, and a separate safety system that slows it down or stops it when something is wrong. The safety system is the one you will be asked about at two in the morning. Its inputs are a defined list: lube oil pressure, jacket water temperature, overspeed, oil mist, thrust bearing temperature, and a few more, each a sensor with its own loop. Its logic is simple and fixed: some inputs cause a slowdown with a warning first, some cause an immediate shutdown. The bridge can cancel a slowdown in an emergency, and on many engines some shutdowns too (never overspeed or the emergency stop; it depends on the engine), with a key or a covered button, and the logic records that it was canceled. A shutdown's output goes to the fuel, through a solenoid or the engine's electronic governor; a slowdown pulls the speed setting back; both go to the alarm system.
Two things matter for you. First, a spurious shutdown is almost always one sensor or its loop, and the system's own display shows which input tripped it; that input gets 5.3 before anybody touches the engine. Second, every input has a test procedure, and the tests are on a schedule; a safety system that has not been tested is a system nobody knows the state of.
Pocket rules. Which input tripped: the display knows. One sensor, one loop, before anyone blames the engine. Know the override and who may use it. Test on the schedule.
Electrical or mechanical. The sensors, loops, the safety system's cabinet and its tests: electrical. The logic and setpoints: fixed by the maker and the class society; changing them is not a ship decision.