c - 为什么有些函数不涉及内核?

标签 c linux linux-kernel system posix

UNIX 环境高级编程第 2 版,第 01 章,第 11 节,有一句话:

For example, the printf function may use the write system call to output a string, but the strcpy (copy a string) and atoi (convert ASCII to integer) functions don't involve the kernel at all.

我不明白的是,为什么可能根本没有内核参与。不是所有例程都需要内核支持吗?

此外,我可能会发现 atoi 只需要 CPU 计算。但是strcpy需要内存操作,为什么也不涉及内核支持呢?

一般来说,如何识别一个函数不涉及内核?

最佳答案

从这句话的上下文来看,似乎是说“不涉及内核”,函数不会导致系统调用。

关于c - 为什么有些函数不涉及内核?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19661556/

相关文章:

linux(红帽)比较目录并复制不同的文件

linux - 如何在 Linux 中打开一个 tensorboard 端口?

c - 为什么我们需要 list_for_each_safe() 来删除内核链表中的节点?

c++ - CPP_TEST.exe : 0xC0000005: Access violation writing location 0x00abcdef 中 0x00af7230 处出现未处理的异常

c - 线程函数中的字符串参数

c - 排序链表(ADT优先级队列)

c - xcrun:错误:在valgrind安装过程中未安装开发人员工具错误

c - 如何在 c/c++(openssl) 中验证任何类型的证书?

linux - 如何在 Suse 上从命令行安装软件包

c - linux-6.0注册设备时如何初始化设备类