Windows、Mac OS X和Linux用什么语言编写?

时间:2021-08-16 16:47:23

I was just wondering who knows what programming languages Windows, Mac OS X and Linux are made up from and what languages are used for each part of the OS (ie: Kernel, plug-in architecture, GUI components, etc).

我只是想知道,谁知道编程语言的Windows、Mac OS X和Linux是由什么组成的,以及在OS (ie:内核、插件体系结构、GUI组件等)中使用什么语言。

I assume that there are multiple languages for each and obviously I know the Linux kernel is written in C.

我假设每种语言都有多种语言,显然我知道Linux内核是用C编写的。

I'm totally guessing here that Mac OS X contains a lot of Objective-C code as it is Apple's language derived from NeXT.

我完全猜Mac OS X包含了很多Objective-C代码,因为它是苹果从NeXT派生出来的语言。

Windows, I have heard contains C, C++ and Intel Assembly. Do Linux or Mac OS contain any Assembly code?

我听说Windows包含C、c++和英特尔汇编。Linux或Mac OS是否包含任何汇编代码?

Also, are there scripting languages like Ruby, Python, etc used by the OS developers for scripting parts of the OS? What parts of the OS would be written in each language?

此外,OS开发人员是否使用过Ruby、Python等脚本语言来编写OS的脚本?操作系统的哪些部分将用每种语言编写?

12 个解决方案

#1


213  

  • Windows: C++, kernel is in C
  • Windows: c++,内核是C语言
  • Mac: Objective C, kernel is in C (IO PnP subsystem is Embedded C++)
  • Mac:目标C,内核在C (IO PnP子系统是嵌入式c++)
  • Linux: Most things are in C, many userland apps are in Python, KDE is all C++
  • Linux:大多数东西都是C语言,很多用户界面应用都是Python语言,KDE都是c++语言

All kernels will use some assembly code as well.

所有的内核都将使用一些汇编代码。

#2


78  

Linux: C. Some parts in assembly.

Linux: C.装配中的一些部件。

[...] It's mostly in C, but most people wouldn't call what I write C. It uses every conceivable feature of the 386 I could find, as it was also a project to teach me about the 386. As already mentioned, it uses a MMU, for both paging (not to disk yet) and segmentation. It's the segmentation that makes it REALLY 386 dependent (every task has a 64Mb segment for code & data - max 64 tasks in 4Gb. Anybody who needs more than 64Mb/task - tough cookies). [...] Some of my "C"-files (specifically mm.c) are almost as much assembler as C. [...] Unlike minix, I also happen to LIKE interrupts, so interrupts are handled without trying to hide the reason behind them. (Source)

[…它主要是用C语言写的,但大多数人不会用我写的C语言来称呼它。它使用了我能找到的386的所有可能的特性,因为它也是一个教我关于386的项目。正如前面提到的,它使用一个MMU,用于两个分页(不包括磁盘)和分段。正是这种分割使得它真正依赖于386个任务(每个任务都有64Mb的代码和数据段——最多有4Gb的64个任务。任何需要超过64Mb/任务的人——难对付的饼干)。[…我的一些“C”文件(特别是mm.c)的汇编程序几乎和C一样多。与minix不同,我也喜欢中断,所以中断被处理时不会试图隐藏背后的原因。(源)

Mac OS X: Cocoa mostly in Objective-C. Kernel written in C, some parts in assembly.

Mac OS X:可可主要在Objective-C中。用C编写的内核,汇编中的一些部分。

Mac OS X, at the kernel layer, is mostly an older, free operating system called BSD (specifically, it’s Darwin, a sort of hybrid of BSD, Mach, and a few other things)... almost entirely C, with a bit of assembler thrown in. (Source)

在内核层,Mac OS X主要是一个较老的、免费的操作系统,叫做BSD(具体来说,它是Darwin,一种BSD、Mach和其他一些东西的混合)……几乎全是C,加入了一些汇编程序。(源)

Much of Cocoa is implemented in Objective-C, an object-oriented language that is compiled to run at incredible speed, yet employes a truly dynamic runtime making it uniquely flexible. Because Objective-C is a superset of C, it is easy to mix C and even C++ into your Cocoa applications. (Source)

很多Cocoa都是在Objective-C中实现的,这是一种面向对象的语言,它被编译成以惊人的速度运行,但是使用一个真正的动态运行时使它具有独特的灵活性。因为Objective-C是C的超集,所以很容易将C甚至c++混合到Cocoa应用程序中。(源)

Windows: C, C++, C#. Some parts in assembler.

Windows:C,c++,c#。汇编程序的某些部分。

We use almost entirely C, C++, and C# for Windows. Some areas of code are hand tuned/hand written assembly. (Source)

我们几乎完全使用C、c++和c#作为Windows。有些代码区域是手工调优/手工编写的程序集。(源)

Unix: C. Some parts in assembly. (Source)

C.装配中的一些部件。(源)

#3


11  

Mac OS X uses large amounts of C++ inside some libraries, but it isn't exposed as they're afraid of the ABI breaking.

Mac OS X在一些库中使用了大量的c++,但由于担心ABI崩溃,它没有被公开。

#4


7  

Windows: Mostly C and C++, some C#

Windows:大部分是C和c++,有些是c#

#5


7  

I understand that this is an old post but Windows is definitely not written in C++. There is lots of C++ in it but what we technical define as an operating system is not in C++. The Windows API, the Windows kernel (both of these are in essence what an operating system is) are written in C. Years ago I was given some leaked code for both Windows 2000 and Windows XP. The code was not nearly complete enough to compile the kernel or API but we were able to compile individual programs and services. For example, we were able to successfully compile Notepad.exe, mspaint.exe, and the spoolsv.exe service (print spooler). All written in C. I have not looked again but I am sure that leaked code still survives as torrent files out there that may still be available.

我知道这是一篇老文章,但Windows绝对不是用c++写的。里面有很多c++,但是我们技术上定义的操作系统不是c++的。Windows API, Windows内核(两者本质上都是操作系统)是用c编写的。代码不够完整,无法编译内核或API,但我们能够编译单独的程序和服务。例如,我们能够成功地编译记事本。exe,mspaint。exe,spoolsv。exe服务(假脱机打印程序)。所有的都是用c写的,我还没有再看一遍,但是我确信泄露的代码仍然作为可能仍然可用的torrent文件存在。

#6


6  

  • windows: C++
  • windows:c++
  • linux: C
  • linux:C
  • mac: Objective C
  • 麦克:Objective - C
  • android: JAVA, C, C++
  • android:JAVA、C、c++
  • Solaris: C, C++
  • Solaris:C、c++
  • iOS 7: Objective-C,Swift,C, C++
  • iOS 7:objective - C,迅速、C、c++

#7


4  

You're right MacOSX has Objective-C in the core.

你说得对,MacOSX的核心是Objective-C。

Windows C++

Windows c++

Linux C

Linux C

About the scripting languages, no, they pretty much high level.

关于脚本语言,不,它们非常高级。

#8


4  

I have read or heard that Mac OS X is written mostly in Objective-C with some of the lower level parts, such as the kernel, and hardware device drivers written in C. I believe that Apple "eat(s) its own dog food", meaning that they write Mac OS X using their own Xcode Developer Tools. The GCC(GNU Compiler Collection) compiler-linker is the unix command line tool that xCode used for most of its compiling and/or linking of executables. Among other possible languages, I know GCC compiles source code from the C, Objective-C, C++ and Objective-C++ languages.

我读过或听说Mac OS X大多是写在objective - c中有一些低水平的部分,如内核,和硬件设备驱动程序用c语言编写我相信苹果”(s)吃自己的狗食”,这意味着他们使用自己的Xcode编写Mac OS X开发工具。GCC(GNU编译器集合)编译器-链接器是unix命令行工具,xCode使用它的大部分编译和/或链接可执行文件。在其他可能的语言中,我知道GCC从C、Objective-C、c++和objective - c++语言编译源代码。

#9


2  

The Linux kernel is mostly written in C (and a bit of assembly language, I'd imagine), but some of the important userspace utilities (programs) are shell scripts written in the Bash scripting language. Beyond that, it's sort of hard to define "Linux" since you basically build a Linux system by picking bits and pieces you want and putting them together, and depending on what an individual Linux user wants, you can get pretty much any language involved. (As Paul said, Python and C++ play important roles)

Linux内核主要是用C语言编写的(我想这是一种汇编语言),但是一些重要的用户空间实用程序(程序)是用Bash脚本语言编写的shell脚本。除此之外,定义“Linux”有点困难,因为您基本上是通过选择您想要的位和块并将它们放在一起来构建Linux系统,并且根据每个Linux用户的需要,您可以获得几乎所有涉及到的语言。(正如Paul所说,Python和c++起着重要作用)

#10


2  

As an addition about the core of Mac OS X, Finder had not been written in Objective-C prior to Snow Leopard. In Snow Leopard it was written in Cocoa, Objective-C

作为Mac OS X内核的一个补充,Finder在Snow Leopard之前并没有在Objective-C中编写。在《雪豹》中,它是用Cocoa, Objective-C写的

#11


2  

See under the heading One Operating System Running On Multiple Platforms where it states:

在标题下,可以看到一个运行在多个平台上的操作系统,它说明:

Most of the source code for Windows NT is written in C or C++.

#12


0  

Windows is obviously not written in C# (!)

Windows显然不是用c#(!)编写的

Simply see the source code of Windows and you'll see...

只要看看Windows的源代码,你就会看到……

#1


213  

  • Windows: C++, kernel is in C
  • Windows: c++,内核是C语言
  • Mac: Objective C, kernel is in C (IO PnP subsystem is Embedded C++)
  • Mac:目标C,内核在C (IO PnP子系统是嵌入式c++)
  • Linux: Most things are in C, many userland apps are in Python, KDE is all C++
  • Linux:大多数东西都是C语言,很多用户界面应用都是Python语言,KDE都是c++语言

All kernels will use some assembly code as well.

所有的内核都将使用一些汇编代码。

#2


78  

Linux: C. Some parts in assembly.

Linux: C.装配中的一些部件。

[...] It's mostly in C, but most people wouldn't call what I write C. It uses every conceivable feature of the 386 I could find, as it was also a project to teach me about the 386. As already mentioned, it uses a MMU, for both paging (not to disk yet) and segmentation. It's the segmentation that makes it REALLY 386 dependent (every task has a 64Mb segment for code & data - max 64 tasks in 4Gb. Anybody who needs more than 64Mb/task - tough cookies). [...] Some of my "C"-files (specifically mm.c) are almost as much assembler as C. [...] Unlike minix, I also happen to LIKE interrupts, so interrupts are handled without trying to hide the reason behind them. (Source)

[…它主要是用C语言写的,但大多数人不会用我写的C语言来称呼它。它使用了我能找到的386的所有可能的特性,因为它也是一个教我关于386的项目。正如前面提到的,它使用一个MMU,用于两个分页(不包括磁盘)和分段。正是这种分割使得它真正依赖于386个任务(每个任务都有64Mb的代码和数据段——最多有4Gb的64个任务。任何需要超过64Mb/任务的人——难对付的饼干)。[…我的一些“C”文件(特别是mm.c)的汇编程序几乎和C一样多。与minix不同,我也喜欢中断,所以中断被处理时不会试图隐藏背后的原因。(源)

Mac OS X: Cocoa mostly in Objective-C. Kernel written in C, some parts in assembly.

Mac OS X:可可主要在Objective-C中。用C编写的内核,汇编中的一些部分。

Mac OS X, at the kernel layer, is mostly an older, free operating system called BSD (specifically, it’s Darwin, a sort of hybrid of BSD, Mach, and a few other things)... almost entirely C, with a bit of assembler thrown in. (Source)

在内核层,Mac OS X主要是一个较老的、免费的操作系统,叫做BSD(具体来说,它是Darwin,一种BSD、Mach和其他一些东西的混合)……几乎全是C,加入了一些汇编程序。(源)

Much of Cocoa is implemented in Objective-C, an object-oriented language that is compiled to run at incredible speed, yet employes a truly dynamic runtime making it uniquely flexible. Because Objective-C is a superset of C, it is easy to mix C and even C++ into your Cocoa applications. (Source)

很多Cocoa都是在Objective-C中实现的,这是一种面向对象的语言,它被编译成以惊人的速度运行,但是使用一个真正的动态运行时使它具有独特的灵活性。因为Objective-C是C的超集,所以很容易将C甚至c++混合到Cocoa应用程序中。(源)

Windows: C, C++, C#. Some parts in assembler.

Windows:C,c++,c#。汇编程序的某些部分。

We use almost entirely C, C++, and C# for Windows. Some areas of code are hand tuned/hand written assembly. (Source)

我们几乎完全使用C、c++和c#作为Windows。有些代码区域是手工调优/手工编写的程序集。(源)

Unix: C. Some parts in assembly. (Source)

C.装配中的一些部件。(源)

#3


11  

Mac OS X uses large amounts of C++ inside some libraries, but it isn't exposed as they're afraid of the ABI breaking.

Mac OS X在一些库中使用了大量的c++,但由于担心ABI崩溃,它没有被公开。

#4


7  

Windows: Mostly C and C++, some C#

Windows:大部分是C和c++,有些是c#

#5


7  

I understand that this is an old post but Windows is definitely not written in C++. There is lots of C++ in it but what we technical define as an operating system is not in C++. The Windows API, the Windows kernel (both of these are in essence what an operating system is) are written in C. Years ago I was given some leaked code for both Windows 2000 and Windows XP. The code was not nearly complete enough to compile the kernel or API but we were able to compile individual programs and services. For example, we were able to successfully compile Notepad.exe, mspaint.exe, and the spoolsv.exe service (print spooler). All written in C. I have not looked again but I am sure that leaked code still survives as torrent files out there that may still be available.

我知道这是一篇老文章,但Windows绝对不是用c++写的。里面有很多c++,但是我们技术上定义的操作系统不是c++的。Windows API, Windows内核(两者本质上都是操作系统)是用c编写的。代码不够完整,无法编译内核或API,但我们能够编译单独的程序和服务。例如,我们能够成功地编译记事本。exe,mspaint。exe,spoolsv。exe服务(假脱机打印程序)。所有的都是用c写的,我还没有再看一遍,但是我确信泄露的代码仍然作为可能仍然可用的torrent文件存在。

#6


6  

  • windows: C++
  • windows:c++
  • linux: C
  • linux:C
  • mac: Objective C
  • 麦克:Objective - C
  • android: JAVA, C, C++
  • android:JAVA、C、c++
  • Solaris: C, C++
  • Solaris:C、c++
  • iOS 7: Objective-C,Swift,C, C++
  • iOS 7:objective - C,迅速、C、c++

#7


4  

You're right MacOSX has Objective-C in the core.

你说得对,MacOSX的核心是Objective-C。

Windows C++

Windows c++

Linux C

Linux C

About the scripting languages, no, they pretty much high level.

关于脚本语言,不,它们非常高级。

#8


4  

I have read or heard that Mac OS X is written mostly in Objective-C with some of the lower level parts, such as the kernel, and hardware device drivers written in C. I believe that Apple "eat(s) its own dog food", meaning that they write Mac OS X using their own Xcode Developer Tools. The GCC(GNU Compiler Collection) compiler-linker is the unix command line tool that xCode used for most of its compiling and/or linking of executables. Among other possible languages, I know GCC compiles source code from the C, Objective-C, C++ and Objective-C++ languages.

我读过或听说Mac OS X大多是写在objective - c中有一些低水平的部分,如内核,和硬件设备驱动程序用c语言编写我相信苹果”(s)吃自己的狗食”,这意味着他们使用自己的Xcode编写Mac OS X开发工具。GCC(GNU编译器集合)编译器-链接器是unix命令行工具,xCode使用它的大部分编译和/或链接可执行文件。在其他可能的语言中,我知道GCC从C、Objective-C、c++和objective - c++语言编译源代码。

#9


2  

The Linux kernel is mostly written in C (and a bit of assembly language, I'd imagine), but some of the important userspace utilities (programs) are shell scripts written in the Bash scripting language. Beyond that, it's sort of hard to define "Linux" since you basically build a Linux system by picking bits and pieces you want and putting them together, and depending on what an individual Linux user wants, you can get pretty much any language involved. (As Paul said, Python and C++ play important roles)

Linux内核主要是用C语言编写的(我想这是一种汇编语言),但是一些重要的用户空间实用程序(程序)是用Bash脚本语言编写的shell脚本。除此之外,定义“Linux”有点困难,因为您基本上是通过选择您想要的位和块并将它们放在一起来构建Linux系统,并且根据每个Linux用户的需要,您可以获得几乎所有涉及到的语言。(正如Paul所说,Python和c++起着重要作用)

#10


2  

As an addition about the core of Mac OS X, Finder had not been written in Objective-C prior to Snow Leopard. In Snow Leopard it was written in Cocoa, Objective-C

作为Mac OS X内核的一个补充,Finder在Snow Leopard之前并没有在Objective-C中编写。在《雪豹》中,它是用Cocoa, Objective-C写的

#11


2  

See under the heading One Operating System Running On Multiple Platforms where it states:

在标题下,可以看到一个运行在多个平台上的操作系统,它说明:

Most of the source code for Windows NT is written in C or C++.

#12


0  

Windows is obviously not written in C# (!)

Windows显然不是用c#(!)编写的

Simply see the source code of Windows and you'll see...

只要看看Windows的源代码,你就会看到……