4 ms·
The linux kernel is actually only about 100 K lines. This is what I get from sloccount, which doesn't count blank lines or comments, for Ubuntu's old 3.0.0 ker
by nitrogen 14y ago
The linux kernel is actually only about 100 K lines.
This is what I get from sloccount, which doesn't count blank lines or comments, for Ubuntu's old 3.0.0 kernel:
Totals grouped by language (dominant language first):
ansic: 9495321 (96.81%)
asm: 241006 (2.46%)
xml: 41486 (0.42%)
perl: 13987 (0.14%)
sh: 4117 (0.04%)
cpp: 3486 (0.04%)
yacc: 2987 (0.03%)
python: 2770 (0.03%)
lex: 1719 (0.02%)
awk: 708 (0.01%)
pascal: 231 (0.00%)
lisp: 218 (0.00%)
sed: 30 (0.00%)
Broken down by path (top 8):
SLOC Directory SLOC-by-Language (Sorted)
5474678 drivers ansic=5469921,yacc=1688,asm=1475,perl=792,lex=779,
sh=23
1848085 arch ansic=1609109,asm=237452,sh=690,awk=470,pascal=231,
perl=58,python=45,sed=30
693955 fs ansic=693955
518275 sound ansic=518092,asm=183
481158 net ansic=481062,awk=96
290060 include ansic=288348,cpp=1670,asm=42
118198 kernel ansic=117893,perl=305
53773 mm ansic=53773
Overall I think your naming convention sounds reasonable; C is also my primary language. Your example was just too easy to shorten to resist ;-).
- jacquesm 14y ago> 118198 kernel ansic=117893,perl=305 That bit is the kernel. File systems, drivers and so on are best though of as plug-ins to the kernel. Architecture dependent code would probably normally expose only one set of symbols rather than all of the code, probably should have included memory management. Likely if you include all that code you'll turn up a few more longish names, but the net effect is pretty much the same: really long names are rare when you've laid things out properly but 30 characters and up are certainly no exception.
- javajosh 14y agoThere's perl in the Linux kernel? Please God tell me that the Linux kernel doesn't have a perl interpreter built into it.
- jacquesm 14y agoThere isn't in the kernel itself but there is perl code in the build process. If you want to build the linux kernel without dependencies on interpreters then you're in for a rough time.
- javajosh 14y agoI figured; I was just being funny. Although actually the thought of embedding an interpreter of some kind in the kernel is very interesting. It would have to be an unusual interpreter, that's for sure, as it would have to operate without a kernel. I'm not sure if that even means anything though, as you'd probably end up implementing kernel-like behavior in your interpreter.
- jacquesm 14y agoI read somewhere - no reference handy - that windows NT contained a prolog engine to do network configuration. edit: found a reference: http://www.drdobbs.com/cpp/extending-c-with-prolog/184409294 http://www.drdobbs.com/cpp/extending-c-with-prolog/184409294
- nitrogen 14y agoThe Berkeley Packet Filter mechanism is implemented as an interpreter in the kernel: http://en.wikipedia.org/wiki/Berkeley_Packet_Filter http://en.wikipedia.org/wiki/Berkeley_Packet_Filter
- jballanc 14y agoThere's a project to embed a Lua interpreter in the NetBSD kernel: http://netbsd-soc.sourceforge.net/projects/luakern/ http://netbsd-soc.sourceforge.net/projects/luakern/