2025年4月12日
摘要: 测量系统调用的和上下文切换的时间 测量系统调用时间 1亿次空读操作,测量平均的系统调用时间 #include <stdio.h> #include <unistd.h> #include <sys/time.h> #define ITERATIONS 1e8 int main(void) { str 阅读全文
posted @ 2025-04-12 23:38 Dylaris 阅读(9) 评论(0) 推荐(0)
摘要: 1.编写一个调用fork()的程序。谁调用fork()之前,让主进程访问一个变量(例如x)并将其值设置为某个值(例如 100)。子进程中的变量有什么值?当子进程和父进程都改变x的值,变量会发生什么? #include <stdio.h> #include <stdlib.h> #include <u 阅读全文
posted @ 2025-04-12 15:07 Dylaris 阅读(12) 评论(0) 推荐(0)