Enis
Enis

Reputation: 171

Is the Operating System a process?

I am just now learning about OSes and I stumbled upon this question from my class' lecture notes. In our class, we define a process as a program in execution and I know that an OS is itself a program. So by this definition, an OS is a process.

At the same time processes can be switched in or out via a context switch, which is something that the OS manages and handles. But what would handle the OS itself when it isn't running?

Also if it is a process, does the OS have a process control block associated with it?

There was an older question on this site that I looked at, but I felt as if the answers weren't clear enough to really outline WHY the OS is/isn't a process so I thought I'd ask again here.

Upvotes: 4

Views: 2496

Answers (5)

RootPhoenix
RootPhoenix

Reputation: 1767

Agreeing to some of the comments above/below.

OS is not a process. However there are few variants in design that give the opposite illusion.

For eg: If you are running a FreeRTOS, then there is no such thing as a separate OS address space and Process address space, every thing runs as a single process, the FreeRTOS framework provides API's that allow Synchronization of different tasks.

Operating System is just a set of API's (system calls) and utilities that help to achieve Multi-processing, Resource sharing etc. For eg: schedule() is a core OS function that handles the multi-processing capabilities of the OS.

In that sense, OS is not a process. Although it attaches to every process that runs on the CPU, otherwise how will the process make use of the OS's API.

Upvotes: 2

user3344003
user3344003

Reputation: 21712

  1. It depends upon what you are calling the "operating system".
  2. It depends upon what operating system you are talking about.

That said and at the risk of gross oversimplification, most of what one calls "the operating system" is generally executed from user processes while in kernel mode. The entry into kernel occurs either through an interrupt, trap or fault.

To do a context switch usually either a process causes a fault entering kernel mode to so something (like write to the disk). While in kernel mode, the process realizes it would have to wait so it yields by switching the context to another process. The other common way is a timer causes an interrupt, that forces the process into kernel mode. The process then determines who should be executed next, and switches the process context.

Some operating systems do have their own kernel process that function but that is increasingly rare.

Most operating system have components that have their own processes.

Upvotes: 0

Jonathon Reinhart
Jonathon Reinhart

Reputation: 137547

First of all, an OS is multiple parts. The core piece is the kernel, which is not a process. It is a framework for running processes. In practice, a process is more than just a "program in execution". On a system with an MMU, a process is usually run in its own virtual address space. The kernel however, is usually mapped into all processes. It's always there.

Other ancillary parts of the OS exist to make it usuable. The OS may have processes that it runs as part of its management. For example, Linux has many kernel threads that are independently scheduled tasks. But these are often not crucial to the OS's operation.

Upvotes: 4

brokenfoot
brokenfoot

Reputation: 11669

It is more like soul for the body (hardware), if you will. It is just not one process but a set of (kernel) processes required to run user processes in the system. PID 0 being the parent of all processes providing scheduler/swapping functionality to the rest of the kernel/user processes, but it is not the only process. These kernel processes (with the help of kernel drivers) provide accessor functionality (through system calls) to the user processes.

Upvotes: 0

paulsm4
paulsm4

Reputation: 121881

Short answer: No.

Here's as good a definition of "Operating System" as any:

https://en.wikipedia.org/wiki/Operating_system

An operating system (OS) is system software that manages computer hardware and software resources and provides common services for computer programs. The operating system is a component of the system software in a computer system. Application programs usually require an operating system to function.

Even "system-level processes" (like "init" on Linux, or "svchost.exe" on Windows) rely on the "operating system" ... but are not themselves the operating system.

Upvotes: 2

Related Questions