0
$\begingroup$

In a computer, the processor executes different threads and changes between them, the operating system is a program at the end that it´s being executed by the processor, there exists the posibility that the processor is not executing the code of the operating system, if there is, shouldn´t this cause problems with the programs being executed on the computer?

$\endgroup$
1
  • $\begingroup$ Yes, your concern is well grounded. For that reason processor and operating system designers have invented the Real Mode - please read: en.wikipedia.org/wiki/Real_mode $\endgroup$
    – HEKTO
    Jan 22, 2019 at 17:20

1 Answer 1

1
$\begingroup$

For full detail, you should consult a textbook on operating systems.

The brief answer is that the operating system doesn't need to be executing all the time. It suffices for it to periodically regain control of the machine, and this happens through so-called "interrupts". Interrupts can happen for a number of reasons:

  • a process that wants the operating system to do something for it (e.g., to perform I/O) can raise an interrupt (known as a "system call");
  • a hardware device that needs attention (e.g., because some I/O that was requested has now completed) alerts the OS by raising an interrupt;
  • the system clock will raise interrupts at some frequency (typically multiple times per second).
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.