Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was looking at different relationships that can exist between an operating system and a user process. I came across the figure below. It shows an architecture where the OS functions execute with user processes.

1) I wanted clarification on the part of the diagram labeled OS function. Is this part exactly the same for all user processes? In other words, is this shared code that each process accesses?

2) Is the only difference between the process switching functions (grey base in diagram) and the OS functions that the OS functions run as user processes whereas the process switching functions operate as OS processes? Why does there have to be such a difference?

One architecture that can be used for execution of the operating system

Accompanying text to provide context to the diagram:

"An alternative that is common with operating systems on smaller computers (PCs, workstations) is to execute virtually all OS software in the context of a user process.The view is that the OS is primarily a collection of routines that the user calls to perform various functions, executed within the environment of the user’s process.... At any given point, the OS is managing n process images......... When an interrupt, trap, or supervisor call occurs, the processor is placed in kernel mode and control is passed to the OS. To pass control from a user program to the OS, the mode context is saved and a mode switch takes place to an operating system routine. However, execution continues within the current user process. Thus, a process switch is not performed, just a mode switch within the same process."

(P.136 Operating Systems by Stallings)

share|improve this question
There are many operating system architectures. Without your telling us which one you want explained to you, you're only going to get incomplete answers at best. The answers to the above will be significantly different amongst Windows NT, OS/2, and Linux, for example, even though the diagram could fit all. – JdeBP Sep 2 '11 at 7:19
Rather than trying to guess what the diagram creator had in mind, find a better explanation and diagram - seriously - as JdeBP suggested, that one's so generic that it gives no insight. – Linker3000 Sep 2 '11 at 10:39
The diagram is supposed to be generic. It is not specific to any OS. It is describing a general OS. Its more about the concept as opposed to the specifics... – rrazd Sep 2 '11 at 13:53
@JdeBP I provided an excerpt from the accompanying paragraph, hopefully this will help give some context to the diagram – rrazd Sep 2 '11 at 14:00
You provided the name of the book. I have that book, and consulting it I find that you're showing us part of a diagram, part (b), not even the whole diagram. Stallings is explaining the various architectures of operating systems with respect to whether the operating system code executes (c) in its own separate processes, (a) outwith the process concept entirely, or (b) within application process contexts; and as such your question here is meaningless, since it is attributing more to Stallings than xe is saying in the first place. – JdeBP Sep 4 '11 at 2:58
up vote 1 down vote accepted

There are many perspectives to consider when explaining the user process and OS/kernel relationship. There's the memory layout and address space, data transfer, processor and execution levels/privileges, and various schemes for scheduling.

A diagram that has been pulled out of context is rather difficult to accurately explain. Where did this diagram come from? What was the accompanying text for this diagram? This could represent something about code organization just as well as something about process scheduling.


The quoted paragraph only helps a little. There's probably more text that is supposed to explain that diagram. The quoted paragraph explains a scheme when "a process switch is not performed". Where's the explanation of when and why a process switch is performed?

The OS maintains state information about each process: the value of registers, the stack and virtual memory; collectively this is called the context of the "process". Just as important is the processor security/privilege level, the "mode".

Stallings mentions that the OS can switch either the "process" or the "mode" of the processor. The paragraph you quoted utilizes these processor states as an alternative method for (efficiently) handling system calls, traps and interrupts. That is, the OS could simply perform just a "mode" switch (from user mode to kernel mode) within the current "process" to service an interrupt/trap/syscall. Every process now has the burden of allocating enough stack space to accommodate system interrupts/traps as well as its own needs. This should partially answer your #2.

For question #1, there's (usually) only one copy of the kernel code in physical memory. So "OS functions" would be shared code. Of course the process has to be in kernel mode in order to have permission to execute kernel code.

share|improve this answer
cool thanks for the addendum, I just needed some clarification which you provided. – rrazd Sep 4 '11 at 15:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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