Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于 Lab 4 中「内核栈」和「运行栈」的命名问题 #104

Open
losfair opened this issue Jul 24, 2020 · 2 comments · May be fixed by #110
Open

关于 Lab 4 中「内核栈」和「运行栈」的命名问题 #104

losfair opened this issue Jul 24, 2020 · 2 comments · May be fixed by #110
Assignees
Labels
enhancement New feature or request

Comments

@losfair
Copy link

losfair commented Jul 24, 2020

Lab 4 的第二节「线程和进程」中,用「运行栈」指代线程在内核态运行时使用的栈;第六节中,用「内核栈」指代中断处理所用的栈。

这对名称有些令人困惑。若与线程的「用户态」对应的是线程的「内核态」,则与「用户栈」相对应的名称可能也是「内核栈」更合适一点。

若参考 Linux 的文档:

Like all other architectures, x86_64 has a kernel stack for every active thread. These thread stacks are THREAD_SIZE (2*PAGE_SIZE) big. These stacks contain useful data as long as a thread is alive or a zombie. While the thread is in user space the kernel stack is empty except for the thread_info structure at the bottom.

In addition to the per thread stacks, there are specialized stacks associated with each CPU. These stacks are only used while the kernel is in control on that CPU; when a CPU returns to user space the specialized stacks contain no useful data. The main CPU stacks are:

  • Interrupt stack. IRQ_STACK_SIZE

则线程在内核态运行时使用的栈似乎应被命名为「内核栈」 (kernel stack) ,而中断处理时使用的栈则应被命名为「中断栈」 (interrupt stack) .

@losfair losfair added the enhancement New feature or request label Jul 24, 2020
@losfair losfair changed the title 关于 Lab 4 中“内核栈”和“运行栈”的命名问题 关于 Lab 4 中「内核栈」和「运行栈」的命名问题 Jul 24, 2020
@Tuyixiang
Copy link
Collaborator

我们教学操作系统的实现中没有实现和 Linux 系统一样的结构,线程只有自己的运行栈(指导中有时会称为“用户栈”,其实应该改为“运行栈”),同时有一个公用的(相当于对于唯一的一个 CPU 有一个)中断栈(指导中称为“内核栈”,其实应该改为“中断栈”)。这里没有对应于 Linux 系统内核栈的结构

我觉得就将名称改为“运行栈”和“中断栈”更加清楚

@losfair
Copy link
Author

losfair commented Jul 25, 2020

👍 赞成使用「运行栈」与「中断栈」

@losfair losfair linked a pull request Jul 25, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants