Re: threads and kernel

Glynn Clements <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <[email protected]>
Shriramana Sharma wrote:

> > When a system call is invoked, the process which has invoked is being
> > interrupted and all the information needed to continue this process is
> > stored for later use.  Now, the process executes higher privileged
> > code that determines what to do next from examining the stack of the
> > less privileged code.  It contains information about the request to be
> > served by the kernel.  When it is finished, it control is returned to
> > the program, restoring the saved state and continuing program
> > execution.
> 
> So technically the kernel instructions would be processed "in" the same
> process and thread that makes the system call, albeit with different
> privelege, right? Or is the process *making the system call* totally
> "paused", as in a "wait" situation when one process waits for another to
> finish?

The kernel is a completely different "process" in so far as it has a
separate task descriptor, and thus a different memory layout etc.

The system call is executed in the same "flow" in that the INT-80
instruction causes the CPU to start executing kernel code; after the
system call has completed, control will eventually return to the
calling process at the instruction after the INT-80.

In that sense, it's similar to a function call, but the similarity
largely stops there.

-- 
Glynn Clements <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.