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/