0

This is my assignment question. Now I understand that the difference between the user mode and kernel mode (I think that is system mode).

But my question is: How the process works in Linux? Does the system have both user mode and system mode stacks for each process it runs?

1 Answer 1

2

I believe that this question has already been answered here:

  1. What is the difference between kernel stack and user stack?
  2. kernel stack and user space stack

That is, a userspace process has only one stack, a pointer to which is defined in the second element of the task_struct in include/linux/sched.h (about line 1045 in 3.12).

There is a possibility of some confusion with the per-thread kernel stack, as noted in the above posts. In a sense, a process can have one or more stacks, userspace and kernel space, depending on the number of threads it has at any point in time. The connection between the per-thread kernel stack, the thread and the process task_struct is described in this lecture by Junfeng Yang.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.