假设我的二进制文件在我无法core dump使用ulimit -c. 工程师如何segmentation faults在如此真实的场景中调试?是否有任何其他方法可以在不core dumps生成的情况下调试或识别崩溃。
这是关于跨不同层的缓存一致性协议cache。我的理解(X86_64)L1是,它由一个核心独占,L2介于两个核心之间,并且L3适用于一个CPU插槽中的所有核心。我已经阅读了MESI协议功能,关于存储缓冲区、无效队列、无效消息等。我的疑问是,它仅MESI适用于L1还是适用于L2并且L3也适用。L2或者 for和之间是否有不同的缓存同步L3。
我对指令流水线有一些疑问。
我有一个大会
0x111: div %ecx
0x112: add $0x13,%ecx #The address 112 is not real, I just kept to show that there is no instructions between div and add
Run Code Online (Sandbox Code Playgroud)
程序计数器,RIP 指向0x111. 我的疑问是,将处理器执行(指令流水线或顺序变化/不限原因)0x112's指令而RIP处于0x111。如果我在 RIP 停止执行0x111,是否有任何机会0x112被执行并且%ecx价值是0X13?
假设我有一个共享库a.so,它是由我的可执行文件第一次加载的。我的理解是,共享库文本部分被映射到VMA的中间。我有两个问题;
(1) ld.so是否会将这个共享内存文本节页面加载到物理内存,然后映射到该进程的VMA?
(2) 假设启动了使用相同共享库的第二个可执行文件a.so。ld.so会识别出这个共享库已经加载到物理内存了吗?如何理解这一点?
linux memory-management shared-libraries dynamic-linking linux-kernel
读完Mel Gorman这本书后我有几个问题Understanding the Linux Virtual Memory Manager。节4.3 Process Address Space Descriptor说kernel threads never page fault or access the user space portion. The only exception is page faulting within the vmalloc space。以下是我的问题。
kenrel 线程从不出现页面错误:这是否意味着只有用户空间代码才会触发页面错误?如果调用kmalloc()or vmalloc(),不会出现页错误吗?我相信内核必须将这些映射到匿名页面。当执行对此页的写入时,会发生页错误。我的理解正确吗?
为什么内核线程不能访问用户空间?不这样做copy_to_user()或者copy_from_user()这样做吗?
Exception is page faulting within vmalloc space:这是否意味着vmalloc()会触发页面错误,但kmalloc()不会?为什么kmalloc()不出现页面错误?内核虚拟地址的物理帧不需要保留为页表条目?
我正在尝试移动结构数组的内容。
#include<stdio.h>
#include<string.h>
typedef struct {
char texts[1024];
}text_i;
text_i textlist[5];
int main()
{
int ind;
strcpy( textlist[0].texts, "hello ..");
strcpy( textlist[1].texts, "world ..");
printf("texts before memcpy\n");
for (ind = 0; ind < 5 ; ind++)
printf("texts ind(%d) is %s \n", ind, textlist[ind].texts);
memcpy( &textlist[1], &textlist[0], 4 * sizeof(text_i));
printf("texts after memcpy\n");
for (ind = 0; ind < 5 ; ind++)
printf("texts ind(%d) is %s \n", ind, textlist[ind].texts);
}
Run Code Online (Sandbox Code Playgroud)
这会将 5 的整个列表打印texts到 string hello ..。
texts before …Run Code Online (Sandbox Code Playgroud) linux-kernel ×3
linux ×2
x86-64 ×2
assembly ×1
c ×1
caching ×1
cpu-cache ×1
crash ×1
crash-dumps ×1
debugging ×1
kernel ×1
memcpy ×1
mesi ×1
page-fault ×1