Linus为什么不用C++写Linux内核?
在最近的一个关于LKML的讨论中,Linus给出了为什么不用C++来写Linux内核的理由:
"In fact, in Linux we did try C++ once already, back in 1992. It sucks. Trust me - writing kernel code in C++ is a BLOODY STUPID IDEA.
“事实上,我们曾经尝试过用C++来写,是在1992年的时候。很糟糕。相信我--用C++来写内核代码是一个非常愚蠢的想法。”
"The fact is, C++ compilers are not trustworthy. They were even worse in 1992, but some fundamental facts haven't changed: 1) the whole C++ exception handling thing is fundamentally broken. It's _especially_ broken for kernels. 2) any compiler or language that likes to hide things like memory allocations behind your back just isn't a good choice for a kernel. 3) you can write object-oriented code (useful for filesystems etc) in C, _without_ the crap that is C++."
“实际上,C++编译器是很不可靠的。在1992年的时候情况就很差了,而且一些基础的东西到现在还没有改变:(1)整个C++对Exception的处理根本就是不完整的,特别是在写内核的时候。(2)任何喜欢把跟内存分配有关的功能匿藏起来的编译器或者程序语言对于编写内核来说都是错误的选择。(3)在C里面你也可以写面向对象的代码(写文件系统的时候很有用),是不需要C++的。
相关文档:
本书全面介绍了Ubuntu Linux的相关知识,内容详实,论述清晰。主要内容包括Ubuntu介绍、文件系统管理、进程管理、压缩与查询系统、Shell应用、TCP/IP基础、网络管理、网络硬盘以及加密安全通信等内容。
本书是一本理论与实践并重的书籍,可作为专业人员的参考书籍,也适合于对Ubuntu ......
维护Linux的ssh工具在使用中,一旦遇到网络中断,则当前的shell就会自动关闭
当前的工作进度就会丢失,这对于远程升级等比较耗费时间的工作是非常不利的
对于远程调适代码也是很不可靠不安全的
为此,可以使用screen这个工具来解决这个问题。
对于最小化的linux,通常screen是不包含在系统内的。
需要查找操作系统的安 ......
fork函数学习:
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
main ()
{
pid_t pid; pid=fork();
if (pid < 0)
printf("error in fork!");
else if (pid == 0)
printf("i ......
Top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器。下面详细介绍它的使用方法。
top - 01:06:48 up 1:22, 1 user, load average: 0.06, 0.60, 0.48
Tasks: 29 total, 1 running, 28 sleeping, 0 stopp ......