This is probably more of a subjective question, but which language (not API like .NET or JDK) would you use should you write your own operating system? Which language provides flexibility, simplicity, and possibly a low-level interface to the hardware? I was thinking Java or C...
这可能更像是一个主观问题,但是如果您编写自己的操作系统,您会使用哪种语言(不是像.NET或JDK这样的API)?哪种语言提供了灵活性,简单性以及可能的硬件低级接口?我在想Java或C ......
26 个解决方案
#1
C, of course.
C,当然。
#2
Haskell.
Once you have flipped the right hardware bits, C is a terrible language to use for the rest of the OS. Things like the scheduler, filesystems, drivers, etc. are complex high-level algorithms, and you don't want to be writing those in assembly language (or C; same thing). It's too hard to get right. (The VM subsystem and memory manager may need to be written in something low-level, as you will need to bootstrap your high-level langauge's runtime somehow.)
一旦你翻转了正确的硬件位,C就是一种可怕的语言,可用于其他操作系统。调度程序,文件系统,驱动程序等等都是复杂的高级算法,您不希望用汇编语言(或C;同样的东西)编写它们。做得太难了。 (VM子系统和内存管理器可能需要以低级别编写,因为您需要以某种方式引导高级语言的运行时。)
Anyway, this isn't just a crazy idea that I am coming up with for SO. Here is an OS written in Haskell: http://programatica.cs.pdx.edu/House/
无论如何,这不仅仅是我为SO想出的疯狂想法。这是一个用Haskell编写的操作系统:http://programatica.cs.pdx.edu/House/
Lisp is another good choice; the original Lisp machines were infinitely more tweakable (at runtime) than "modern" OSes like UNIX and Windows.
Lisp是另一个不错的选择;原始的Lisp机器(在运行时)比UNIX和Windows等“现代”操作系统更具可调性。
Sometimes history forgets good ideas (often in the name of "maximum performance"), and that makes me sad.
有时候历史会忘记好的想法(通常以“最大表现”的名义),这让我很难过。
#3
D would be an interesting choice. From its own description:
D将是一个有趣的选择。从它自己的描述:
D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. Special attention is given to the needs of quality assurance, documentation, management, portability and reliability.
D是一种系统编程语言。它的重点是将C和C ++的强大功能和高性能与Ruby和Python等现代语言的程序员生产力相结合。特别关注质量保证,文档,管理,可移植性和可靠性的需求。
The D runtime assumes the existence of a garbage collector, which would not be appropriate for the very lowest levels of the kernel. However, it would be appropriate for many of the higher layers.
D运行时假设存在垃圾收集器,这不适合内核的最低级别。但是,它适用于许多较高层。
#4
Build the basic components like task schedulers and drivers etc with Assembly, then build the higher level components like applications and tools with C
使用Assembly构建任务调度程序和驱动程序等基本组件,然后使用C构建更高级别的组件,如应用程序和工具
I believe this is how Windows XP was built too (unsure about Windows Vista and Windows 7).
我相信这也是Windows XP的构建方式(不确定Windows Vista和Windows 7)。
#5
Definitely... C
#7
- Low-level in something like Haskell or D. Productivity over performance, in my opinion. You can rewrite slow parts in C++ or even assembly later if the need arises.
- High-level in Python or Ruby. Ideally I'd also have a really fast JIT-capable VM for that language, but that's not going to happen for either language for a while. Lua would be a good alternative if speed gets in the way.
在我看来,像Haskell或D.这样的低级别的生产力超过了性能。如果需要,您可以在C ++中重写慢速部件,甚至可以在以后组装。
Python或Ruby中的高级。理想情况下,我也有一个非常快速的JIT支持该语言的VM,但这种情况不会发生在一段时间内。如果速度受阻,Lua将是一个不错的选择。
#8
The kernel has to be written in a low-level language, C is by far the best choice for this, because it is so memory efficient. The higher levels could be built with a combination of Java or more ideally Objective-C, and scripting languages like python and ruby, or lua.
内核必须用低级语言编写,C是目前最好的选择,因为它的内存效率很高。更高级别可以使用Java或更理想的Objective-C和脚本语言(如python和ruby,或lua)的组合构建。
#9
Honestly, I would either use C or some hierarchy of languages that I had either designed or fit together completely seamlessly. What I would be looking for is a seamless experience that starts at the bare metal level and then I could move to higher and higher level languages as I moved up the problem space. I would probably chose something like:
老实说,我要么使用C语言,要么使用我设计的语言层次结构,或者完全无缝地组合在一起。我想要的是从裸机级别开始的无缝体验,然后随着我向上移动问题空间,我可以移动到越来越高级别的语言。我可能会选择以下内容:
- C - for bare metal stuff like drivers, kernel, etc
- Java/C# - for application-level things like administration consoles, OS apps
- Python/PowerShell - for scripting activities like common administrative tasks (creating a new user, etc)
C - 用于驱动程序,内核等裸机
Java / C# - 用于管理控制台,操作系统应用程序等应用程序级别的事情
Python / PowerShell - 用于脚本活动,如常见的管理任务(创建新用户等)
Personally, I think C/C#/PowerShell is more tightly integrated and the type of experience I'd be looking for. Of course, if I ever got so ambitious as to write an OS, I would have a lot of spare time on my hands and would probably really enjoy tackling the language stack first. So maybe it would be L/L#/LScript ...
就个人而言,我认为C / C#/ PowerShell的集成度更高,而且我正在寻找的体验类型。当然,如果我有如此雄心勃勃的写作操作系统,我会有很多空闲时间在我的手上,并且可能真的很喜欢先处理语言堆栈。所以也许它会是L / L#/ LScript ......
#10
BitC seems to have this in mind. Despite it's name it seems to be the midpoint of assembly language and lisp. The goal was to make a language with a strong correspondence with machine language but have an intermediate representation that supports stronger correctness inferences than is possible with most other common languages. The languages was created as part of the Coyotos project, an operating system with lofty goals of security and reliability. Formal verification is made significantly possible with the ir used in BitC.
BitC似乎考虑到了这一点。尽管它的名字似乎是汇编语言和lisp的中点。目标是使语言与机器语言有很强的对应关系,但是具有支持比大多数其他常用语言更强的正确推理的中间表示。这些语言是Coyotos项目的一部分,Coyotos项目是一个具有高安全性和可靠性目标的操作系统。使用BitC中使用的ir可以显着地进行形式验证。
#11
Ada:
Ada is a structured, statically typed, imperative, and object-oriented high-level computer programming language, extended from Pascal and other languages. It was originally designed by a team led by Jean Ichbiah of CII Honeywell Bull under contract to the United States Department of Defense (DoD) from 1977 to 1983 to supersede the hundreds of programming languages then used by the DoD. Ada is strongly typed and compilers are validated for reliability in mission-critical applications, such as avionics software.
Ada是一种结构化,静态类型,命令式和面向对象的高级计算机编程语言,从Pascal和其他语言扩展而来。它最初由CII Honeywell Bull的Jean Ichbiah领导的团队设计,该团队于1977年至1983年与美国国防部(DoD)达成合同,取代国防部当时使用的数百种编程语言。 Ada是强类型的,编译器在任务关键型应用程序(如航空电子软件)中的可靠性得到验证。
Ada, because it was not only specifically developed for such projects, but it also provides support for several very useful high level features (such as support for strong typing, concurrency and abstraction) that are simply not available in standard C.
Ada,因为它不仅专门为这些项目开发,而且还支持几个非常有用的高级功能(例如支持强类型,并发和抽象),这些功能在标准C中根本不可用。
So that, even as a project grows, you don't have to work around language limitations (think encapsulation, abstraction, namespaces in C).
因此,即使项目增长,您也不必解决语言限制(想想C中的封装,抽象和命名空间)。
Don't get me wrong, C works obviously for a great many of projects, but once a project has gained a certain size (think Linux kernel, gcc, GNOME), you will inevitably appreciate certain features of more high level languages to make the development process less tedious and also less obfuscated.
不要误会我的意思,C很明显适用于很多项目,但是一旦项目获得了一定的规模(想想Linux内核,gcc,GNOME),你就不可避免地会欣赏更多高级语言的某些特性来制作开发过程不那么繁琐,也不那么混淆。
In C however, these features usually end up being -pretty poorly- emulated by excessive and almost pervert use of the pre-processor (this can for example be seen in the gcc code base), so that you get to see lots of nested macros, that from an implementation point of view, actually emulate features found in other programming languages.
然而,在C语言中,这些特性通常最终被过度且几乎不正确地使用预处理器(例如可以在gcc代码库中看到)模拟得很差,因此您可以看到许多嵌套宏从实现的角度来看,实际上是模拟其他编程语言中的功能。
In addition, Ada is the only programming language, that I am aware of, that actually provides standardized support for source code analysis using the ASIS, having such a facility in place is however the prerequisite to actually be able to maintain and transform/re-engineer a code base in the long run (think refactoring).
此外,Ada是我所知道的唯一一种编程语言,它实际上为使用ASIS的源代码分析提供了标准化支持,但是具备这样的设施是实际能够维护和转换/重新设置的先决条件。从长远来看,设计一个代码库(想想重构)。
Having an interface like ASIS available, means that you can actually implement "semantic patching", where you can automatically rename a file, function or variable/data structure and it will actually work.
像ASIS这样的界面可用,意味着您可以实际实现“语义修补”,您可以自动重命名文件,函数或变量/数据结构,它实际上可以工作。
#12
Java ?? no jave runs on a virtual machine which needs an os to run on top of , maybe C and some ASM ;)
Java ??没有jave在虚拟机上运行,需要一个操作系统才能运行,可能是C和一些ASM;)
#13
I would go with D to see whether it can do it.
我会和D一起去看它是否能做到。
#14
I would only pick the following 3 out of practicality.
我只会选择以下3个实用性。
- C (good old fashioned)
- C++ (C with stuff tacked on. Windows is partially written in this)
- Java (the medium level language that just might have a capable garbage collector with controllable pauses with G1).
C(老式)
C ++(C添加了东西.Windows部分写在此)
Java(中级语言,可能有一个功能强大的垃圾收集器,可以暂停G1)。
#15
If I were going to start a new OS I'd do it with the subset of C++ recommended by the embedded industry. You can use things like classes and use it "as a better C" and be just as fast. Just avoid things that have massive overhead. You can even use some template features, if you stick to a certain subet that basically don't have any overhead. Look on embedded.com for features in C++ that have little to no overhead, but will allow you organize your code better than you ever could in C.
如果我要开始一个新的操作系统,我会使用嵌入式行业推荐的C ++子集。你可以使用像类这样的东西,并将它作为“更好的C”使用,并且速度也一样快。避免那些有大量开销的事情。你甚至可以使用一些模板功能,如果你坚持一个基本上没有任何开销的特定子目录。在embedded.com上查看C ++中几乎没有开销的功能,但是可以让你比C中更好地组织代码。
#16
Oberon? I guess I miss Pascal too much some times. C paid the bills for quite a while, but I don't really love it.
奥伯伦?我想有时候我会错过帕斯卡尔。 C支付了相当一段时间的账单,但我并不喜欢它。
#17
Lisp of course!
Title text: Some say the world will end in fire; some say in segfaults.
标题文本:有人说世界将以火焰结束;有人说在段错误中。
#18
For an OS, you want speed at the lowest levels. So assembly, C, C++, Objective-C, or Java seem to be the current choices. Although it's just recently that Java got fast, and it's hard for me to imagine an OS with garbage collection.
对于操作系统,您希望速度处于最低级别。因此,汇编,C,C ++,Objective-C或Java似乎是当前的选择。虽然最近Java速度很快,但我很难想象一个带垃圾收集的操作系统。
If I were writing my own, it would be a mix of assembly and C.
如果我自己编写,那将是汇编和C的混合。
#19
A C or C++ microkernel with a JIT for a highly dynamic language like Ruby or maybe a language with native support for the Prototype pattern. Even device drivers in that language.
带有JIT的C或C ++微内核,用于高度动态的语言,如Ruby,或者是一种原生支持Prototype模式的语言。甚至是该语言的设备驱动程序。
Not because it's practical but because it's really cool. Cool in the way that NeXTStep was cool for using Obj-C for pretty much everything.
不是因为它很实用,而是因为它非常酷。酷酷的NeXTStep很酷的方式使用Obj-C几乎所有的东西。
#20
http://www.dwheeler.com/sloc/redhat71-v1/redhat71sloc.html - share of languages in Linux's source code.
http://www.dwheeler.com/sloc/redhat71-v1/redhat71sloc.html - Linux源代码中的语言共享。
#21
C, by a number of reasons. Other candidates, like D, are great. However, C has this advantage: there's a lot of available open-sourced C code that you could reuse in your project (much more than is for other languages appropriate for system programming).
C,由多种原因造成的。像D这样的其他候选人都很棒。但是,C具有以下优势:您可以在项目中重复使用大量可用的开源C代码(远远超过适用于系统编程的其他语言)。
#22
I would be torn between using some existing low level language and write my own based on C# but with much better generics support. In second case I would make each method generic, but all the constraints will be resolved by compiler - to allow "duck typing" like in Scala but still language should be static. Also static virtual methods would lower the codebase.
我会在使用一些现有的低级语言和基于C#编写我自己的语言之间挣扎,但有更好的泛型支持。在第二种情况下,我会使每个方法都是通用的,但所有约束都将由编译器解决 - 允许像Scala一样“鸭子打字”,但仍然语言应该是静态的。静态虚拟方法也会降低代码库。
I've had that idea for a long time, but it never seems to be doable in real timeframe, so who knows maybe in the future. :-)
我已经有了很长一段时间的想法,但它在实时框架中似乎永远不可行,所以谁知道将来也许。 :-)
#23
Some would say Java.
有人会说Java。
Note that openfirmware is written partly in Forth, and it's very low level.
请注意,openfirmware部分写入Forth,并且它的级别非常低。
Have an open mind.
要有开放的心态。
#24
"The kernel has to be written in a low-level language, C is by far the best choice for this, because it is so memory efficient. "
“内核必须用低级语言编写,C是迄今为止最好的选择,因为它的内存效率非常高。”
Um... What about FORTH?
嗯...... FORTH怎么样?
FORTH can be low level and high level, so you could have a whole operating system written in FORTH from the ground up, and still have a nice easy REPL scripting environment on top, also in FORTH.
FORTH可以是低级别和高级别的,所以你可以从头开始用FORTH编写一个完整的操作系统,并且仍然有一个很好的简单的REPL脚本环境,也在FORTH中。
However, any decent operating system should support lots of langauges on top, from C all the way to Python Ruby and Javascript. Making FORTH the basis for it all has a lot of benefits though.
但是,任何体面的操作系统都应该支持许多语言,从C语言到Python Ruby和Javascript。尽管如此,为FORTH奠定基础有很多好处。
edit: I'd only ever attempt this for an embedded environment with a single known hardware set. Trying to write an OS that could compete with Linux or Windows is a fools job.
编辑:我只会尝试使用单一已知硬件集的嵌入式环境。试图编写一个可以与Linux或Windows竞争的操作系统是一项愚蠢的工作。
#25
If this isn't a hypothetical question, and you're looking to create your own OS, I'd probably go with C because most of the examples out there are written in C.
如果这不是一个假设的问题,并且您正在寻找创建自己的操作系统,我可能会选择C,因为大多数示例都是用C语言编写的。
Also, (And I haven't build an OS yet so take this with a grain of salt), I'm thinking that the c runtime libraries would be a lot easier to port to your new OS than say .NET.
另外,(而且我还没有构建一个操作系统,所以考虑到这一点),我认为c运行时库比.NET更容易移植到新的操作系统上。
#26
Pascal + Oberon: they have the power of C and C++ but they're not as daunting to use. Both these languages are grossly under appreciated.
Pascal + Oberon:他们拥有C和C ++的强大功能,但它们并没有那么令人畏惧。这两种语言都受到了极大的赞赏。
#1
C, of course.
C,当然。
#2
Haskell.
Once you have flipped the right hardware bits, C is a terrible language to use for the rest of the OS. Things like the scheduler, filesystems, drivers, etc. are complex high-level algorithms, and you don't want to be writing those in assembly language (or C; same thing). It's too hard to get right. (The VM subsystem and memory manager may need to be written in something low-level, as you will need to bootstrap your high-level langauge's runtime somehow.)
一旦你翻转了正确的硬件位,C就是一种可怕的语言,可用于其他操作系统。调度程序,文件系统,驱动程序等等都是复杂的高级算法,您不希望用汇编语言(或C;同样的东西)编写它们。做得太难了。 (VM子系统和内存管理器可能需要以低级别编写,因为您需要以某种方式引导高级语言的运行时。)
Anyway, this isn't just a crazy idea that I am coming up with for SO. Here is an OS written in Haskell: http://programatica.cs.pdx.edu/House/
无论如何,这不仅仅是我为SO想出的疯狂想法。这是一个用Haskell编写的操作系统:http://programatica.cs.pdx.edu/House/
Lisp is another good choice; the original Lisp machines were infinitely more tweakable (at runtime) than "modern" OSes like UNIX and Windows.
Lisp是另一个不错的选择;原始的Lisp机器(在运行时)比UNIX和Windows等“现代”操作系统更具可调性。
Sometimes history forgets good ideas (often in the name of "maximum performance"), and that makes me sad.
有时候历史会忘记好的想法(通常以“最大表现”的名义),这让我很难过。
#3
D would be an interesting choice. From its own description:
D将是一个有趣的选择。从它自己的描述:
D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. Special attention is given to the needs of quality assurance, documentation, management, portability and reliability.
D是一种系统编程语言。它的重点是将C和C ++的强大功能和高性能与Ruby和Python等现代语言的程序员生产力相结合。特别关注质量保证,文档,管理,可移植性和可靠性的需求。
The D runtime assumes the existence of a garbage collector, which would not be appropriate for the very lowest levels of the kernel. However, it would be appropriate for many of the higher layers.
D运行时假设存在垃圾收集器,这不适合内核的最低级别。但是,它适用于许多较高层。
#4
Build the basic components like task schedulers and drivers etc with Assembly, then build the higher level components like applications and tools with C
使用Assembly构建任务调度程序和驱动程序等基本组件,然后使用C构建更高级别的组件,如应用程序和工具
I believe this is how Windows XP was built too (unsure about Windows Vista and Windows 7).
我相信这也是Windows XP的构建方式(不确定Windows Vista和Windows 7)。
#5
Definitely... C
#6
#7
- Low-level in something like Haskell or D. Productivity over performance, in my opinion. You can rewrite slow parts in C++ or even assembly later if the need arises.
- High-level in Python or Ruby. Ideally I'd also have a really fast JIT-capable VM for that language, but that's not going to happen for either language for a while. Lua would be a good alternative if speed gets in the way.
在我看来,像Haskell或D.这样的低级别的生产力超过了性能。如果需要,您可以在C ++中重写慢速部件,甚至可以在以后组装。
Python或Ruby中的高级。理想情况下,我也有一个非常快速的JIT支持该语言的VM,但这种情况不会发生在一段时间内。如果速度受阻,Lua将是一个不错的选择。
#8
The kernel has to be written in a low-level language, C is by far the best choice for this, because it is so memory efficient. The higher levels could be built with a combination of Java or more ideally Objective-C, and scripting languages like python and ruby, or lua.
内核必须用低级语言编写,C是目前最好的选择,因为它的内存效率很高。更高级别可以使用Java或更理想的Objective-C和脚本语言(如python和ruby,或lua)的组合构建。
#9
Honestly, I would either use C or some hierarchy of languages that I had either designed or fit together completely seamlessly. What I would be looking for is a seamless experience that starts at the bare metal level and then I could move to higher and higher level languages as I moved up the problem space. I would probably chose something like:
老实说,我要么使用C语言,要么使用我设计的语言层次结构,或者完全无缝地组合在一起。我想要的是从裸机级别开始的无缝体验,然后随着我向上移动问题空间,我可以移动到越来越高级别的语言。我可能会选择以下内容:
- C - for bare metal stuff like drivers, kernel, etc
- Java/C# - for application-level things like administration consoles, OS apps
- Python/PowerShell - for scripting activities like common administrative tasks (creating a new user, etc)
C - 用于驱动程序,内核等裸机
Java / C# - 用于管理控制台,操作系统应用程序等应用程序级别的事情
Python / PowerShell - 用于脚本活动,如常见的管理任务(创建新用户等)
Personally, I think C/C#/PowerShell is more tightly integrated and the type of experience I'd be looking for. Of course, if I ever got so ambitious as to write an OS, I would have a lot of spare time on my hands and would probably really enjoy tackling the language stack first. So maybe it would be L/L#/LScript ...
就个人而言,我认为C / C#/ PowerShell的集成度更高,而且我正在寻找的体验类型。当然,如果我有如此雄心勃勃的写作操作系统,我会有很多空闲时间在我的手上,并且可能真的很喜欢先处理语言堆栈。所以也许它会是L / L#/ LScript ......
#10
BitC seems to have this in mind. Despite it's name it seems to be the midpoint of assembly language and lisp. The goal was to make a language with a strong correspondence with machine language but have an intermediate representation that supports stronger correctness inferences than is possible with most other common languages. The languages was created as part of the Coyotos project, an operating system with lofty goals of security and reliability. Formal verification is made significantly possible with the ir used in BitC.
BitC似乎考虑到了这一点。尽管它的名字似乎是汇编语言和lisp的中点。目标是使语言与机器语言有很强的对应关系,但是具有支持比大多数其他常用语言更强的正确推理的中间表示。这些语言是Coyotos项目的一部分,Coyotos项目是一个具有高安全性和可靠性目标的操作系统。使用BitC中使用的ir可以显着地进行形式验证。
#11
Ada:
Ada is a structured, statically typed, imperative, and object-oriented high-level computer programming language, extended from Pascal and other languages. It was originally designed by a team led by Jean Ichbiah of CII Honeywell Bull under contract to the United States Department of Defense (DoD) from 1977 to 1983 to supersede the hundreds of programming languages then used by the DoD. Ada is strongly typed and compilers are validated for reliability in mission-critical applications, such as avionics software.
Ada是一种结构化,静态类型,命令式和面向对象的高级计算机编程语言,从Pascal和其他语言扩展而来。它最初由CII Honeywell Bull的Jean Ichbiah领导的团队设计,该团队于1977年至1983年与美国国防部(DoD)达成合同,取代国防部当时使用的数百种编程语言。 Ada是强类型的,编译器在任务关键型应用程序(如航空电子软件)中的可靠性得到验证。
Ada, because it was not only specifically developed for such projects, but it also provides support for several very useful high level features (such as support for strong typing, concurrency and abstraction) that are simply not available in standard C.
Ada,因为它不仅专门为这些项目开发,而且还支持几个非常有用的高级功能(例如支持强类型,并发和抽象),这些功能在标准C中根本不可用。
So that, even as a project grows, you don't have to work around language limitations (think encapsulation, abstraction, namespaces in C).
因此,即使项目增长,您也不必解决语言限制(想想C中的封装,抽象和命名空间)。
Don't get me wrong, C works obviously for a great many of projects, but once a project has gained a certain size (think Linux kernel, gcc, GNOME), you will inevitably appreciate certain features of more high level languages to make the development process less tedious and also less obfuscated.
不要误会我的意思,C很明显适用于很多项目,但是一旦项目获得了一定的规模(想想Linux内核,gcc,GNOME),你就不可避免地会欣赏更多高级语言的某些特性来制作开发过程不那么繁琐,也不那么混淆。
In C however, these features usually end up being -pretty poorly- emulated by excessive and almost pervert use of the pre-processor (this can for example be seen in the gcc code base), so that you get to see lots of nested macros, that from an implementation point of view, actually emulate features found in other programming languages.
然而,在C语言中,这些特性通常最终被过度且几乎不正确地使用预处理器(例如可以在gcc代码库中看到)模拟得很差,因此您可以看到许多嵌套宏从实现的角度来看,实际上是模拟其他编程语言中的功能。
In addition, Ada is the only programming language, that I am aware of, that actually provides standardized support for source code analysis using the ASIS, having such a facility in place is however the prerequisite to actually be able to maintain and transform/re-engineer a code base in the long run (think refactoring).
此外,Ada是我所知道的唯一一种编程语言,它实际上为使用ASIS的源代码分析提供了标准化支持,但是具备这样的设施是实际能够维护和转换/重新设置的先决条件。从长远来看,设计一个代码库(想想重构)。
Having an interface like ASIS available, means that you can actually implement "semantic patching", where you can automatically rename a file, function or variable/data structure and it will actually work.
像ASIS这样的界面可用,意味着您可以实际实现“语义修补”,您可以自动重命名文件,函数或变量/数据结构,它实际上可以工作。
#12
Java ?? no jave runs on a virtual machine which needs an os to run on top of , maybe C and some ASM ;)
Java ??没有jave在虚拟机上运行,需要一个操作系统才能运行,可能是C和一些ASM;)
#13
I would go with D to see whether it can do it.
我会和D一起去看它是否能做到。
#14
I would only pick the following 3 out of practicality.
我只会选择以下3个实用性。
- C (good old fashioned)
- C++ (C with stuff tacked on. Windows is partially written in this)
- Java (the medium level language that just might have a capable garbage collector with controllable pauses with G1).
C(老式)
C ++(C添加了东西.Windows部分写在此)
Java(中级语言,可能有一个功能强大的垃圾收集器,可以暂停G1)。
#15
If I were going to start a new OS I'd do it with the subset of C++ recommended by the embedded industry. You can use things like classes and use it "as a better C" and be just as fast. Just avoid things that have massive overhead. You can even use some template features, if you stick to a certain subet that basically don't have any overhead. Look on embedded.com for features in C++ that have little to no overhead, but will allow you organize your code better than you ever could in C.
如果我要开始一个新的操作系统,我会使用嵌入式行业推荐的C ++子集。你可以使用像类这样的东西,并将它作为“更好的C”使用,并且速度也一样快。避免那些有大量开销的事情。你甚至可以使用一些模板功能,如果你坚持一个基本上没有任何开销的特定子目录。在embedded.com上查看C ++中几乎没有开销的功能,但是可以让你比C中更好地组织代码。
#16
Oberon? I guess I miss Pascal too much some times. C paid the bills for quite a while, but I don't really love it.
奥伯伦?我想有时候我会错过帕斯卡尔。 C支付了相当一段时间的账单,但我并不喜欢它。
#17
Lisp of course!
Title text: Some say the world will end in fire; some say in segfaults.
标题文本:有人说世界将以火焰结束;有人说在段错误中。
#18
For an OS, you want speed at the lowest levels. So assembly, C, C++, Objective-C, or Java seem to be the current choices. Although it's just recently that Java got fast, and it's hard for me to imagine an OS with garbage collection.
对于操作系统,您希望速度处于最低级别。因此,汇编,C,C ++,Objective-C或Java似乎是当前的选择。虽然最近Java速度很快,但我很难想象一个带垃圾收集的操作系统。
If I were writing my own, it would be a mix of assembly and C.
如果我自己编写,那将是汇编和C的混合。
#19
A C or C++ microkernel with a JIT for a highly dynamic language like Ruby or maybe a language with native support for the Prototype pattern. Even device drivers in that language.
带有JIT的C或C ++微内核,用于高度动态的语言,如Ruby,或者是一种原生支持Prototype模式的语言。甚至是该语言的设备驱动程序。
Not because it's practical but because it's really cool. Cool in the way that NeXTStep was cool for using Obj-C for pretty much everything.
不是因为它很实用,而是因为它非常酷。酷酷的NeXTStep很酷的方式使用Obj-C几乎所有的东西。
#20
http://www.dwheeler.com/sloc/redhat71-v1/redhat71sloc.html - share of languages in Linux's source code.
http://www.dwheeler.com/sloc/redhat71-v1/redhat71sloc.html - Linux源代码中的语言共享。
#21
C, by a number of reasons. Other candidates, like D, are great. However, C has this advantage: there's a lot of available open-sourced C code that you could reuse in your project (much more than is for other languages appropriate for system programming).
C,由多种原因造成的。像D这样的其他候选人都很棒。但是,C具有以下优势:您可以在项目中重复使用大量可用的开源C代码(远远超过适用于系统编程的其他语言)。
#22
I would be torn between using some existing low level language and write my own based on C# but with much better generics support. In second case I would make each method generic, but all the constraints will be resolved by compiler - to allow "duck typing" like in Scala but still language should be static. Also static virtual methods would lower the codebase.
我会在使用一些现有的低级语言和基于C#编写我自己的语言之间挣扎,但有更好的泛型支持。在第二种情况下,我会使每个方法都是通用的,但所有约束都将由编译器解决 - 允许像Scala一样“鸭子打字”,但仍然语言应该是静态的。静态虚拟方法也会降低代码库。
I've had that idea for a long time, but it never seems to be doable in real timeframe, so who knows maybe in the future. :-)
我已经有了很长一段时间的想法,但它在实时框架中似乎永远不可行,所以谁知道将来也许。 :-)
#23
Some would say Java.
有人会说Java。
Note that openfirmware is written partly in Forth, and it's very low level.
请注意,openfirmware部分写入Forth,并且它的级别非常低。
Have an open mind.
要有开放的心态。
#24
"The kernel has to be written in a low-level language, C is by far the best choice for this, because it is so memory efficient. "
“内核必须用低级语言编写,C是迄今为止最好的选择,因为它的内存效率非常高。”
Um... What about FORTH?
嗯...... FORTH怎么样?
FORTH can be low level and high level, so you could have a whole operating system written in FORTH from the ground up, and still have a nice easy REPL scripting environment on top, also in FORTH.
FORTH可以是低级别和高级别的,所以你可以从头开始用FORTH编写一个完整的操作系统,并且仍然有一个很好的简单的REPL脚本环境,也在FORTH中。
However, any decent operating system should support lots of langauges on top, from C all the way to Python Ruby and Javascript. Making FORTH the basis for it all has a lot of benefits though.
但是,任何体面的操作系统都应该支持许多语言,从C语言到Python Ruby和Javascript。尽管如此,为FORTH奠定基础有很多好处。
edit: I'd only ever attempt this for an embedded environment with a single known hardware set. Trying to write an OS that could compete with Linux or Windows is a fools job.
编辑:我只会尝试使用单一已知硬件集的嵌入式环境。试图编写一个可以与Linux或Windows竞争的操作系统是一项愚蠢的工作。
#25
If this isn't a hypothetical question, and you're looking to create your own OS, I'd probably go with C because most of the examples out there are written in C.
如果这不是一个假设的问题,并且您正在寻找创建自己的操作系统,我可能会选择C,因为大多数示例都是用C语言编写的。
Also, (And I haven't build an OS yet so take this with a grain of salt), I'm thinking that the c runtime libraries would be a lot easier to port to your new OS than say .NET.
另外,(而且我还没有构建一个操作系统,所以考虑到这一点),我认为c运行时库比.NET更容易移植到新的操作系统上。
#26
Pascal + Oberon: they have the power of C and C++ but they're not as daunting to use. Both these languages are grossly under appreciated.
Pascal + Oberon:他们拥有C和C ++的强大功能,但它们并没有那么令人畏惧。这两种语言都受到了极大的赞赏。