摘要: glibc pthread_mutex_t实现原理 __pthread_mutex_lock -> lll_lock: 宏, 传递指针给__lll_lock宏 -> __lll_lock: cas替换pthread_lock_t->__data.__lock 0->1成功则返回, 失败根据是否锁为私 阅读全文
posted @ 2025-05-10 17:38 yghr 阅读(4) 评论(0) 推荐(0)
摘要: 动态链接和静态链接 ldd实际上是调用/lib64/ld-linux-x86-64.so.2动态库(注意,这也是一个可执行文件)进行一些操作。 readelf -l ./unbound在program headers里可以看到对应的解释器 readelf -d ./unbound查看动态段 read 阅读全文
posted @ 2025-04-25 02:02 yghr 阅读(12) 评论(0) 推荐(0)
摘要: rte_eal_init只是初始化mcfg中的数据结构,并未关联到对应的大页内存 rte_eal_init eal_hugepage_info_init "/sys/kernel/mm/hugepages" "/dev/hugepages" /var/run/dpdk/rte/hugepage_in 阅读全文
posted @ 2025-03-30 16:11 yghr 阅读(18) 评论(0) 推荐(0)
摘要: DPDK eal初始化 内存管理:大页,内存池 驱动 开启调试信息 make config T=x86_64-native-linuxapp-gcc export EXTRA_CFLAGS='-O0 -g3 -ggdb' make -j8 dpdk通过makefile编译 meson + ninja 阅读全文
posted @ 2025-02-23 21:06 yghr 阅读(146) 评论(0) 推荐(0)
摘要: 概述 fbarray是一个固定大小的多进程共享的内存块数组。 struct rte_fbarray { char name[RTE_FBARRAY_NAME_LEN]; /**< name associated with an array */ unsigned int count; /**< nu 阅读全文
posted @ 2024-12-08 17:15 yghr 阅读(23) 评论(0) 推荐(0)
摘要: mesh结构 msg_cache + rr_cache缓存数据 msg_cache里的entry是msgreply_entry,rr_cache里的entry是ub_packed_rrset_key。 ub_packed_rrset_key的rrset_id_type通过alloc_get_id方法 阅读全文
posted @ 2024-11-05 00:06 yghr 阅读(26) 评论(0) 推荐(0)
摘要: unbound入口在run_daemon方法。 daemon_init方法,分配struct daemon结构体,设置信号处理方法,初始化openssl库,设置时区,设置daemon->need_to_exit为0,初始化模块栈(modstack_init方法)设置deamon->mods结构体(s 阅读全文
posted @ 2024-11-05 00:04 yghr 阅读(71) 评论(0) 推荐(0)
摘要: 在一个pthread_once方法内又再次调用了这个pthread_once导致死锁。 分析下这个pthread_once的源码: 可以看到这个pthread_once_t结构体就是一个整形数字加自旋锁。 int ___pthread_once (pthread_once_t *once_contr 阅读全文
posted @ 2024-08-06 23:46 yghr 阅读(47) 评论(0) 推荐(0)
摘要: gcc函数调用 进入一个函数后的栈布局 /* + + | 第6个参数后的参数(如果有) | + + | 返回地址(调用函数的下一个指令)| + + | 上一个函数rbp | + + | 当前函数局部变量 | + + */ makecontext方法实现 void __makecontext (uco 阅读全文
posted @ 2024-07-31 23:40 yghr 阅读(33) 评论(0) 推荐(0)
摘要: unbound可以通过配置文件中的cache-max-ttl来设置缓存的最大缓存时间,这个会保存MAX_TTL全局变量(默认值是10天)。 unbound在处理递归响应时的调用链是comm_point_udp_callback -> outnet_udp_cb -> serviced_udp_cal 阅读全文
posted @ 2024-06-14 01:09 yghr 阅读(96) 评论(0) 推荐(0)