0

We all know that the Operating Systems is responsible for handling resources needed by user application. The OS is also a piece of code that runs, then how does it manages other user programs?

does the OS runs on dedicated processor and monitor the user program on some other processor?

how does the OS actually handles user applications?

  • This is a broad topic better suited to https://electronics.stackexchange.com/. – Austin Jan 27 '19 at 15:31
  • @Austin: I don't think it is a question about electronics. But it is still off-topic and too broad for Stack Overflow – Basile Starynkevitch Jan 27 '19 at 15:48
  • 1
    Possible duplicate of [What is the mechanism that allows the scheduler to switch which threads are executing?](https://stackoverflow.com/questions/53634050/what-is-the-mechanism-that-allows-the-scheduler-to-switch-which-threads-are-exec) – slebetman Jan 27 '19 at 18:15
  • @BasileStarynkevitch - Agreed, if there was a stack overflow for computer engineering, that would be the place to go, but the EE stack overflow often has more microcontroller talk and this seems like a fundemental computer engineering topic. – Austin Jan 28 '19 at 16:07

2 Answers2

2

It depends upon the structure of the operating system. For any modern operating system the kernel is invoked through exceptions or interrupts. The operating system "monitors" processes during interrupts. An operating system schedules timer interrupts. When the timer goes off the interrupt handler determines whether it needs to switch to a different process.

Another OS management path is through exceptions. An application invokes the operating system through exceptions. An exception handler can also cause the operating system to switch to another process. If a process invokes a read and wait system service, that exception handler will certainly switch to a new process.

In ye olde days, it was common for multi-processors to have one processor that was the dedicated master and was the only processor to handle certain tasks. Now, all normal operating systems use symmetric multi-processing where any processor can handle any task.

user3344003
  • 20,574
  • 3
  • 26
  • 62
0

An entire book is needed to answer your too broad question.

Read Operating System: Three Easy Pieces (a freely downloadable book).

does the OS runs on dedicated processor and monitor the user program on some other processor?

In general no. The same processor (or core) is either in user-mode (for user programs; read about user space and process isolation and protection rings) or in supervisor-mode (for the operating system kernel)

how does the OS actually handles user applications?

Often by providing system calls which are done, in some controlled way, from applications.

Some academic OSes, e.g. Singularity, have been designed with other principles in mind (formal proof techniques for isolation).

Read also about micro-kernels, unikernels, etc.

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547