What language is used to write operating systems (Windows)? [closed]

旧时模样 提交于 2019-12-11 02:56:00

问题


What is the language used to write operating systems (Windows) or a boot CD?


回答1:


Boot loaders are usually written in Assembly, as well as low-level kernel parts, like hardware drivers.
The kernel itself can be written in different languages, like Assembly, C or C++.




回答2:


Maybe you want to look into the Singularity Project.

Its from Microsoft Reseach, on how today a OS could be built.

there you find a lot of papers, on the concepts of building an OS.

Singularity




回答3:


Operating Systems can be written in pretty much any language, and there are plenty of Operating Systems written in an whole bunch of languages. Just a couple of examples:

  • Singularity is written in Sing# which is a superset of Spec#, which in turn is a superset of C#
  • House is written in Haskell
  • all of the Lisp OS's are written in Lisp
  • there are several Smalltalk OSs written in Smalltalk
  • many embeddded OSs are written in Forth
  • SharpOS and Cosmos are written in C#
  • NewOS and JNode are written in Java
  • Ununumium used to be written largely in Python, but now they have shifted their focus, it is written largely in assembly
  • You can argue whether JS/UX is an OS or not, but it is written in JavaScript
  • Modula-2 was explicitly invented for the purpose of writing an OS
  • Oberon also was explicitly invented for OS development
  • the original MacOS was written in Pascal
  • the original OS/400 was written in Modula-2 and PL/MI
  • Eleanor McHugh has some preliminary ideas for writing an OS in Ruby
  • the Windows NT kernel is written largely in C, however the farther away you get from the kernel, there might be some C++ or even C# in there



回答4:


I'm pretty sure the earliest versions of Windows were written primarily in Pascal. That's why you can still find references to pascal calling conventions in old documents and header files, though AFAIK those conventions only ever applied to 16 bit Windows.

[EDIT - I'm now pretty sure I was told a while ago that this is wrong. Microsoft had reasons for using Pascal call conventions that I don't remember, but didn't use Pascal for coding Windows (or the majority of it or whatever)].

These days, Windows is probably written in a mixture of languages, though with the emphasis strongly on C and C++. For example, some parts of .NET are probably written in C#, and these days that easily counts as an O/S component.

Similarly, I'll bet there are at least a few Objective C components in modern versions of the Mac O/S.

There are a lot of languages that are somewhat suited to writing operating systems. In niche areas, I'm certain you'll find Ada, Modula 2 and more.

Imperative languages without garbage collection are probably most common because of the relative ease of interfacing to hardware and assembler code. However, most functional languages are impure. There are low-level versions of Lisp around, if you look hard enough. And ML-family languages and Haskell have probably been used in operating systems, at least for research/academic purposes.

In fact, I wouldn't be surprised to find even a bit of Prolog in some operating systems components - and certainly some code written using custom-made domain specific languages.

A real-world operating system is usually a very large software system. Even embedded operating systems have a fair bit of complexity, e.g. for options you don't need for your hardware but someone else does. I've never worked on one, but I'll bet that to get that working, the developers are primarily pragmatists - using whatever they have that works to get the job done.




回答5:


Well, the question is also "What is the operating system?" (does bundled Internet Explorer count in?), but otherwise I believe Windows is mostly C and C++.



来源:https://stackoverflow.com/questions/3317329/what-language-is-used-to-write-operating-systems-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!