1) Is the operating system hardware or software?

2) What are the functions/goals/role of the operating system?

3) How is a computer system protected from a user program that goes into an infinite loop?

4) Modern CPU's have (at least) dual-modes of operation where there are two (or more) modes of operation: user mode and system(/supervisor/system/monitor) mode. A mode-bit(s) within the CPU's processor-status-word (PSW) register is used to indicate whether the CPU is executing is user or system mode. The set of all machine-language instructions are divided into:

a) privileged instructions that can only be executed in system mode, and

b) non-privileged instructions that can be executed in any mode of operation.

Every time an instruction is executed by the CPU, the hardware checks to see if the instruction is privileged and the mode is user. Whenever this case is detected, an exception (internal interrupt) is generated that turns CPU control back over to the operating system.

Can you think of some privileged instructions related to the answer to question (3) above?