6.5 linux
来源:互联网 发布:易语言自动刷图源码 编辑:程序博客网 时间:2024/06/04 19:52
Process descriptors handling
process in Kernel Mode access a stack contained in the Kernel data segement.
Kernel control paths make little us of the stack , only a few thousand bytes of kernel stack are required.
when stack and thread_info are contained in a single page frame ---->the kernel uses a few additional stacks to avoid the overflows caused by deeply nested interrupts and exception.
two data structure are stored in the 2-page (8KB) memory area.
The thread_info resides at the beginning of the memory area.
The stack grows downward from the end.
The esp register is the CPU stack pointer, which is used to address the stack's top location.
when it was switching from user mode to kernel mode, the kernel stack of a process is always empty.esp register points to the byte immediately followitng the stack.The value of the esp is decreased as soon as date is written into the stack.
The thread_info structure is stored starting at address 0x15fa000 and the stack is stored starting at address 0x15fc000.
the kernel uses the alloc_thread_info and free_thread_info macros to allocate and release the memory area stroing a thread_info and a kernel stack.
Identifying the current process
If the thread_union structure is 8KB 2^13 bytes long, the kernel masks out the 13 least significant bits of esp to obtain the base address of the thread_info
if the thread_info structure 4KB long, the kernel masks out he 12 least significant bits of esp .
(his is one by the current _thread_info)
after executing,p contains the thread_info structure pointer of the process running on the CPU that execute the instruction.
the kernel makes use of the current macro, which is essentially equivalent to current_thread_info()->task.
after executing , pcontains the process descriptor pointer of the process running on the CPU.
the current macro often appears in kernel code as a prefix to fields of the process descriptor.e.g. current->pid returns the process ID of the process currently running.
Doubly linked list
a set of primitive operations must be implemented: initializing the list, inserting ,deleting,scannning the list and son on.
list_head data structure whose only fields next and prev represent the forward and back pointer of a generic doubly linked list element.
the pointers in a lis_head field store the addresses of other list_head fields rather than the addresses of the whole data structures in which the list _head fields structure is included.
list_add(n,p)
list_add_tail(n,p)
list_del(p)
list_empty(p)
list_entry(p,t,m)
list_for_each(p,h)
list_for_each_entry(p,h,m)
- 6.5 linux
- Linux-6.5-服务器模型
- linux 6.5 安装vim
- Linux 6.5系统优化
- hadoop2.6.5 linux安装
- linux 6.5 杂集
- linux
- linux
- Linux
- Linux
- LINUX!
- Linux
- linux
- linux
- linux
- Linux
- linux
- linux
- 虚拟机ubuntu14.04系统使用samba与win7文件共享
- 视频会议直播和存储
- Python多级排序(多属性排序)csv文件
- x210v3开发板u-boot-2012.10移植之一---uboot版本选择
- 北外教授举报何炅吃空饷 遭悉心培养学生辱骂
- 6.5 linux
- #面经准备#RSA EMC
- 如何添加".Net Framework Data Provider for MySQL"配置信息到目标主机中?
- MRI task-base Experiment
- 关于RectTransform的一些研究
- leetcode 222: Count Complete Tree Nodes
- LeetCode 题解(97): Binary Tree Maximum Path Sum
- 丫的一个三线手机还挺火
- 天龙网游帮会玩法详解 帮会系统详细介绍