3 ms·
So I don't know much about kernel development. How many other languages apart from C are there in the kernel?
by Jonnax 6y ago
So I don't know much about kernel development.
How many other languages apart from C are there in the kernel?
- BlackLotus89 6y agoAssembler. Although there is a movement to port assembler to c.
- pjmlp 6y agoWhich is impossible with ISO C alone, so it will either stay Assembly, just written inline, or replaced by CPU compiler specific intrinsics, yet another GCC C feature.
- ajdlinux 6y agoIt's true that some of it will remain assembly forever, but there are large chunks of existing assembly in the kernel that can be ported to regular C and where the current code paths are getting too long to be effectively maintainable in assembly - you can split out the parts that specifically touch magic registers, etc etc and keep those in asm while moving more complex logic into C.
- rwmj 6y agoDepends how you define "in the kernel". In terms of what is compiled into the kernel image, it's C plus small pieces of assembler (both inline and in separate files). This proposal (if it ever happens) would be about adding Rust to that. If you mean the tree used to build the kernel, you could say it includes shell script, Makefiles, the Kconfig descriptions, and more. If you mean all the bits you need to have a very minimally working system which boots, you'd want to include all the languages used for the necessary userspace tools like the init system and udev (although the vast majority of that is also C and shell scripts).
- correct_horse 6y agoI'm a bit uninformed as well. Obviously it must use assembly in some places, it has makefiles for building and some scripts in perl. Here's what a cloc clone has to say. tokei =============================================================================== Language Files Lines Code Comments Blanks =============================================================================== ASN.1 11 484 343 33 108 Assembly 3 2751 2450 0 301 GNU Style Assembly 1296 370153 270691 56418 43044 Autoconf 6 347 303 20 24 Automake 3 31 23 3 5 BASH 54 1991 1438 321 232 C 28971 19846129 14634535 2351170 2860424 C Header 21110 6056898 4465297 1010398 581203 C++ 8 2313 2016 68 229 C++ Header 2 125 59 55 11 CSS 1 137 80 29 28 Device Tree 3351 900862 735380 54238 111244 Gherkin (Cucumber) 1 252 174 50 28 Happy 9 5750 5061 0 689 HEX 1 86 86 0 0 INI 1 7 3 3 1 JSON 328 174872 174872 0 0 LD Script 15 412 317 48 47 Makefile 2587 64666 43896 10957 9813 Module-Definition 2 124 109 0 15 Perl 53 40583 31126 3931 5526 Python 118 36932 29072 2980 4880 ReStructuredText 2621 548840 417105 0 131735 Ruby 1 29 25 0 4 Shell 556 85666 59725 10972 14969 SVG 59 39038 37555 1405 78 Plain Text 3230 239573 0 197373 42200 Unreal Script 5 716 446 162 108 Vim script 1 42 33 6 3 XSL 15 300 183 78 39 YAML 921 91167 72962 3985 14220 =============================================================================== Total 65340 28511276 20985365 3704703 3821208 ===============================================================================