What small projects would you suggest to a novice with the kernel, but someone who has plenty of systems and C experience? The aim is to develop a familiarity with the kernel source code, and a facility for experimentation with crazy ideas.
对于一个使用内核的新手,但是有丰富的系统和C经验的人来说,您会建议他们做哪些小项目呢?其目的是开发对内核源代码的熟悉程度,以及对疯狂想法进行实验的工具。
I'm trying to think of some manageable small tasks (for example, add a syscall), but what would you suggest? For a target audience think someone who has at least an undergraduate OS course under their belt.
我正在尝试考虑一些可管理的小任务(例如,添加一个syscall),但是您有什么建议?对于目标受众来说,想想那些至少有一个本科操作系统课程的人。
5 个解决方案
#1
6
When I took the aforementioned undergraduate OS course, one of our tasks was to add a few syscalls. They were extremely simple, nothing but reading and resetting counters that counted the number of times other syscalls were invoked. However, adding a syscall requires looking at and modifying quite a few files.. a lot of them are in the same relatively-small subtree of the kernel source, but its enough to get you familiar with the coding conventions, at least.
当我上了前面提到的本科OS课程时,我们的任务之一就是添加一些syscalls。它们非常简单,除了读取和重新设置计数器(用来计算调用其他syscalls的次数)之外什么都没有。但是,添加syscall需要查看和修改相当多的文件。它们中的许多都在内核源代码的相对小的子树中,但至少这足以让您熟悉编码约定。
You might also consider:
你也可以考虑:
-
Adding another (very simple) mode to the scheduler to implement a policy you find interesting. The "one implementation to rule them all" is quite hard (and even harder to agree on), but doing a simple O(N) scheduler, even a rudimentary O(1) scheduler, can be done relatively simply, algorithmically speaking. Even so, it requires poking through a lot of code.
向调度器添加另一个(非常简单的)模式来实现您感兴趣的策略。“一个实现来管理它们所有”是相当困难的(甚至更难达成一致),但是做一个简单的O(N)调度器,甚至是一个基本的O(1)调度器,从算法上讲,可以相对简单地完成。即便如此,它仍然需要大量的代码。
-
Writing a device driver for a very simple piece of external hardware, like an 8-bit microcontroller that communicates via serial, or even something you build yourself. If you have any hardware experience, maybe try to write a device driver that can emulate an NES controller (bit-bang a few wires using the serial port and maybe a serial-to-parallel shift register). You could also do something like driving a really simple 7-segment LED display (like you have in an alarm clock), or a small collection of them.
为非常简单的外部硬件编写设备驱动程序,比如通过串口进行通信的8位微控制器,甚至是您自己构建的东西。如果您有任何硬件经验,可以尝试编写一个设备驱动程序来模拟一个NES控制器(使用串口和一个串行到并行移位寄存器对一些线路进行位敲)。你也可以做一些事情,比如驱动一个非常简单的7段LED显示屏(就像你在闹钟里一样),或者收集一小部分。
#3
6
At the risk of starting a flame war: I'd recommend you to stay away from Linux kernel code. If you want to get your hands dirty with kernel programming, go with FreeBSD, NetBSD or OpenSolaris, for example. The code is much cleaner and better-structured (this is of course subjective opinion), actually designed, and even documented. Plus they have a kernel debugger (note that Linus is against both kernel debuggers and stable kernel API, which makes any kernel a moving target for your work). These OS-es even have a list of projects on their respective web-sites, and I personally have extremely good experience with people on OpenSolaris forums and NetBSD mailing lists.
冒着引发激烈争论的风险:我建议您远离Linux内核代码。如果你想弄脏你的内核编程,可以使用FreeBSD、NetBSD或OpenSolaris,例如。代码更清晰,结构更好(当然这是主观意见),实际上是设计的,甚至是文档化的。此外,它们还有一个内核调试器(请注意,Linus是针对内核调试器和稳定的内核API的,这使得任何内核都成为您工作的移动目标)。这些OS-es甚至在它们各自的web站点上都有一个项目列表,我个人在OpenSolaris论坛和NetBSD邮件列表上都有非常好的经验。
You say that you have experience with C -- look at web source code repositories of Linux and of OpenSolaris or some of BSDs, compare the code, and make your own opinion. What I'm saying is, I guess, that there's more to open-source UNIX than Linux, and that you should at least look at them before going for Linux.
您说您有使用C的经验——查看Linux和OpenSolaris或某些BSDs的web源代码存储库,比较代码,并提出您自己的意见。我想说的是,开源UNIX比Linux有更多的东西,你至少应该在学习Linux之前先看看它们。
#4
2
A nice place to start is a project based on Unix v6. "Xv6, a simple Unix-like teaching operating system"
一个好的起点是一个基于Unix v6的项目。“Xv6,一个简单的类unix教学操作系统”
There is also cynix, a simple IA-32 monolithic unix-like kernel (Unmaintained)
还有cynix,一个简单的IA-32单片类unix内核(未维护)
A great tutorial is "Roll your own toy UNIX-clone OS".
一个很棒的教程是“滚动自己的玩具UNIX-clone OS”。
#5
0
Try downloading the MINIX source code and play with it,try understanding the logic and it will take time no doubt but if you stick to it you can be an expert in some time
试着下载MINIX源代码并使用它,试着理解它的逻辑,毫无疑问,这需要时间,但如果你坚持下去,你迟早会成为专家
#1
6
When I took the aforementioned undergraduate OS course, one of our tasks was to add a few syscalls. They were extremely simple, nothing but reading and resetting counters that counted the number of times other syscalls were invoked. However, adding a syscall requires looking at and modifying quite a few files.. a lot of them are in the same relatively-small subtree of the kernel source, but its enough to get you familiar with the coding conventions, at least.
当我上了前面提到的本科OS课程时,我们的任务之一就是添加一些syscalls。它们非常简单,除了读取和重新设置计数器(用来计算调用其他syscalls的次数)之外什么都没有。但是,添加syscall需要查看和修改相当多的文件。它们中的许多都在内核源代码的相对小的子树中,但至少这足以让您熟悉编码约定。
You might also consider:
你也可以考虑:
-
Adding another (very simple) mode to the scheduler to implement a policy you find interesting. The "one implementation to rule them all" is quite hard (and even harder to agree on), but doing a simple O(N) scheduler, even a rudimentary O(1) scheduler, can be done relatively simply, algorithmically speaking. Even so, it requires poking through a lot of code.
向调度器添加另一个(非常简单的)模式来实现您感兴趣的策略。“一个实现来管理它们所有”是相当困难的(甚至更难达成一致),但是做一个简单的O(N)调度器,甚至是一个基本的O(1)调度器,从算法上讲,可以相对简单地完成。即便如此,它仍然需要大量的代码。
-
Writing a device driver for a very simple piece of external hardware, like an 8-bit microcontroller that communicates via serial, or even something you build yourself. If you have any hardware experience, maybe try to write a device driver that can emulate an NES controller (bit-bang a few wires using the serial port and maybe a serial-to-parallel shift register). You could also do something like driving a really simple 7-segment LED display (like you have in an alarm clock), or a small collection of them.
为非常简单的外部硬件编写设备驱动程序,比如通过串口进行通信的8位微控制器,甚至是您自己构建的东西。如果您有任何硬件经验,可以尝试编写一个设备驱动程序来模拟一个NES控制器(使用串口和一个串行到并行移位寄存器对一些线路进行位敲)。你也可以做一些事情,比如驱动一个非常简单的7段LED显示屏(就像你在闹钟里一样),或者收集一小部分。
#2
#3
6
At the risk of starting a flame war: I'd recommend you to stay away from Linux kernel code. If you want to get your hands dirty with kernel programming, go with FreeBSD, NetBSD or OpenSolaris, for example. The code is much cleaner and better-structured (this is of course subjective opinion), actually designed, and even documented. Plus they have a kernel debugger (note that Linus is against both kernel debuggers and stable kernel API, which makes any kernel a moving target for your work). These OS-es even have a list of projects on their respective web-sites, and I personally have extremely good experience with people on OpenSolaris forums and NetBSD mailing lists.
冒着引发激烈争论的风险:我建议您远离Linux内核代码。如果你想弄脏你的内核编程,可以使用FreeBSD、NetBSD或OpenSolaris,例如。代码更清晰,结构更好(当然这是主观意见),实际上是设计的,甚至是文档化的。此外,它们还有一个内核调试器(请注意,Linus是针对内核调试器和稳定的内核API的,这使得任何内核都成为您工作的移动目标)。这些OS-es甚至在它们各自的web站点上都有一个项目列表,我个人在OpenSolaris论坛和NetBSD邮件列表上都有非常好的经验。
You say that you have experience with C -- look at web source code repositories of Linux and of OpenSolaris or some of BSDs, compare the code, and make your own opinion. What I'm saying is, I guess, that there's more to open-source UNIX than Linux, and that you should at least look at them before going for Linux.
您说您有使用C的经验——查看Linux和OpenSolaris或某些BSDs的web源代码存储库,比较代码,并提出您自己的意见。我想说的是,开源UNIX比Linux有更多的东西,你至少应该在学习Linux之前先看看它们。
#4
2
A nice place to start is a project based on Unix v6. "Xv6, a simple Unix-like teaching operating system"
一个好的起点是一个基于Unix v6的项目。“Xv6,一个简单的类unix教学操作系统”
There is also cynix, a simple IA-32 monolithic unix-like kernel (Unmaintained)
还有cynix,一个简单的IA-32单片类unix内核(未维护)
A great tutorial is "Roll your own toy UNIX-clone OS".
一个很棒的教程是“滚动自己的玩具UNIX-clone OS”。
#5
0
Try downloading the MINIX source code and play with it,try understanding the logic and it will take time no doubt but if you stick to it you can be an expert in some time
试着下载MINIX源代码并使用它,试着理解它的逻辑,毫无疑问,这需要时间,但如果你坚持下去,你迟早会成为专家