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?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

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.

Community
  • 1
  • 1
Jonathan Ben-Avraham
  • 4,615
  • 2
  • 34
  • 37