Re: program execution in user space and in kernel space.



guru <guru.naveen@xxxxxxxxx> writes:

HI All,

I want to know, what do mean by program execution in user space and
program execution in kernel space.

What I know is, when program invokes calls any system call, it starts
executing in kernel space. But what about in user space? What makes
these execution differ?

The important difference is between the CPU's kernel mode and user
mode. To a first approximation, in kernel mode the code has access to
the full resources of the computer, while in user mode there are
restrictions on what can be done. So, there are typically instructions
that can only be executed in kernel mode (such as instructions to load
privileged system registers or to perform hardware input and output),
and memory areas are marked as accessible from user mode vs. accessible
only in kernel mode (user-accessible memory is also accessible from
kernel mode).

Your program and the C standard library (and any other libraries you're
using) execute in user mode, while the operating system kernel executes
in kernel mode.
--
As we enjoy great advantages from the inventions of others, we should
be glad of an opportunity to serve others by any invention of ours;
and this we should do freely and generously. (Benjamin Franklin)
.



Relevant Pages

  • Re: Kernel Mode vs. User Mode
    ... Couldn't you replace the instruction after the transition with a breakpoint? ... >the boundary between kernel and user space) then at that point I'm practically at a loss as ... >>> I'm thinking of other ways to trace the execution of a program. ... threads transition between user mode and kernel mode often. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: 0.020 ms ping time to localhost is slow?!
    ... time is spent, task switching, user mode, kernel mode, etc. ... Some docs I read on kernel mode linux suggested that system calls are ... like 30 times slower from user space than they are from kernel space ( ...
    (comp.os.linux.networking)
  • Re: Differece between printf and printk
    ... ring buffer which is in kernel mode, and I am confused about Kernel ... Space and User Space have 2 different memory space and they are ...
    (comp.os.linux.misc)
  • Re: Checkpoint/restart (was Re: [PATCH 0/4] - v2 - Object creation with a specified id)
    ... kernel representation. ... If the state can be inferred from user space it is visible to user ... In the worst case today we can restore a checkpoint by replaying all of ... Checkpoints coordinated between multiple containers or real ...
    (Linux-Kernel)
  • Re: [OT] ALSA userspace API complexity
    ... Why we have X servers in user space (and only some supporting code is in the kernel) then? ... Can you do this with ALSA way? ... comercial OSS have ALSA emulation and ALSA have OSS emulation. ...
    (Linux-Kernel)

Loading