Fog Creek Software
Discussion Board




What language is Windows written in?

Can anyone point me to any information on the development process for Windows. I'm curious what languages/tools Microsoft uses.

Curious

Curious
Wednesday, February 12, 2003

Check out "Inside Windows 2000" or "Inside Windows NT 4.0" from Microsoft Press.

The architect was grabbed from Digital Electronics Corporation(merged to compaq which then merged to HP) (the same guy who did VMS).

I don't know if the entire Kernel code is mandated by MS to be coded in C++.

Li-fan Chen
Wednesday, February 12, 2003

<nitpick>
That was Digital *Equpment* Corporation (DEC).
</nitpick>

From a old-timer who remembers when DEC was state-of-the-art.  Sigh.......

sgf
Wednesday, February 12, 2003

<nitpick>
That was Digital *Equipment* Corporation (DEC).
</nitpick>

(out nitpicked baby, YEAH!)

I was always under the impressed the core of windows was straight C.  Hence the win32 api.

MFC being a c++ class wrappers to the straight C win32 api.

I am prepared to be wrong on this. 

Braid_Ged

braid_ged
Wednesday, February 12, 2003

I've seen somewhere that Windows was at least initially written in C.  And as we all know, complete rewrites is a big no-no, so I take it Windows is still mainly C.

I would bet that there is small parts of assembly language neatly tucked away in the kernel internals, that deals with low level task switching routines and device drivers and such things.

Patrik
Wednesday, February 12, 2003

>I was always under the impressed the core ....
<nitpick>
I was always under the impression the core....
</nitpick>

Sorry couldn't resist ;-)

Patrik
Wednesday, February 12, 2003

Sorry, I got family working at DEC, I oughta know the difference!! :D

Li-fan Chen
Wednesday, February 12, 2003

Doods,

MFC is in C++

It's a wrapper around Win32, in C

There's also core ANSI libs, that's in C or C++ depending on what you are calling in Visual C++

And .Net libraries mostly are wrappers to all that C/C++ where performance in native CLR assembly is unrealistic, the rest of which is high-level DOTNET code compiled to CLR assembly.

The kernel space.. I still don't know what language it's in.. probably very very few assembly, a bit of C, and lots of C++.

Li-fan Chen
Wednesday, February 12, 2003

Any ideas what source control/compilers they use? Do they actually use their own products for this or do they roll their own?

Curious
Wednesday, February 12, 2003

They mostly use their own compilers. However, they do NOT use sourcesafe. They have a hacked up, er, customized version of Perforce for most stuff, plus some old stuff on a system called SLM (I think).

Kinda funny - I got the chance to visit MS's data center about 7 years ago. They actually had a Vax sitting in there; apparently it was their SCC repository.

Chris Tavares
Wednesday, February 12, 2003

Chris -

about that Vax, it may have been surprising that it was there, but not necessarily that surprising that it was *still* there. Your comment made me flashback a bit--DEC used to build their hardware very ruggedly. As late as 92, while still in the Army, I can recall seeing hundreds of MicroVaxII's (those were the little 'end-table' units on casters that got replaced with the much smaller MicroVax3xxx series that were desktop-type cabinets) getting transported all over the world in military conexes. You'd have to witness the loading and unloading procedure to believe it and get an appreciation for the rough handling those machines got. They were stock boxes--not ruggedized at all. But I've seen them in Germany, winter, in the field--I mean in an open soccer field--under only the edge of a big plastic fest tent, just under the camo net, stacked up on top of each other --in the half-frozen mud-- with casters partly sunk into the mud. They were humming along happily, big huge loops of 10Base-5 cable coiled up and draped over the pile of machines. We'd have stacks like this dotted various places around this temporary installation for the duration of an exercise, wherever we could stick the machines out of our way but just so it wouldn't rain directly into them.

At the end of the exercise in Germany, it would all get torn down, (almost literally) thrown back onto the semi-trailer conexes to get air-lifted or sea-lifted to some place like Korea for one of their exercises. Those MicroVaxII's had a hell of a hard life, but they were build as physically solid as any piece of IT hardware I've personally seen.

I can only imagine how hard the big Vax's would have been to kill.

ok. enough of the way-back machine. back to the present...

anonQAguy
Wednesday, February 12, 2003

The windows kernel is written in C. I base this on the observation that all the APIs for driver development are C, and on seeing sysinternals' map of the kernel source files, which all end in ".c".

(I think they do use a tiny bit of MS "structured exception handling" and of course some platform-specific assembly so it's not 100% pure ANSI C).

The low-level Win32 libraries are also in C (user32, gdi32, etc). C++ is only used for high-level wrappers (MFC) and some very new libraries (GDI+).

Dan Maas
Wednesday, February 12, 2003

The folklore 10 years ago went as follows:

MS-DOS: mostly assembly language.

Windows 3.1: mostly assembly language, some supplied applications coded in C.

Windows 9x/ME: the 16 bit subsystem was salvaged from DOS and Win 3.1 and therefore was written in assembly language; the rest was a combination of assembler and C.  Win 9x was designed to work well on suboptimal, older hardware (486s and such), therefore needed the speed advantage of assembly language. Remember that Win 95 was originally packaged as an upgrade from Windows 3.1.

Windows NT (which implies Windows 2000 and XP): mostly C, with some assembly language at the kernel and device driver level. The design goal of NT was said to be potential portability, and assembly language efficiency  was a secondary concern. The portions in C were designed to be ported to other CPUs and platforms such as Alpha.

Bored Bystander
Wednesday, February 12, 2003

Java

Sunburn
Thursday, February 13, 2003

yeah right!

Prakash S
Thursday, February 13, 2003

This is an excellent presentation from one of the primary NT engineers (Mark Lucovsky) a few years back

http://www.usenix.org/events/usenix-win2000/invitedtalks/lucovsky_html/

Talks about the transition from the start of NT 3.1 to 2000, including how they solved the scalability issues of such a large development team and code base.

Some choice tidbits:
3.1 "Six guys from DEC, One guy from Microsoft
Schedule: 18months (only missed our date by 3 years)"

Win2K: "Full source base required about 50Gb of disk space"

"New source code control system identified 3/99 (SourceDepot)"

AEB
Thursday, February 13, 2003

See http://www.winsupersite.com/reviews/winserver2k3_gold1.asp

and http://www.winsupersite.com/reviews/winserver2k3_gold2.asp

According to various books, most of the HAL is written in assembler, as are performance critical components such as the kernel trap handler and the NTFS compression engine. As other have said, the rest of the kernel is written in C. I believe the shell is written in C++.

John Topley
Thursday, February 13, 2003

Going by the stability and "fit for purpose"-ness, 68000 machine code.


Thursday, February 13, 2003

The majority of the Windows kernel is in C, there was a very small amount of assembler in the original Windows.  Layers on top of that kernel can be in anything you like.

The stack frame uses the old MS-Pascal ordering rather than the native C plus BP layout.  I never really understood why they did it that way but once it was decided it became granite.

Simon Lucy
Thursday, February 13, 2003

Windows NT and Windows 2000 are different animals, they are operating systems, Windows isn't, but the windowing kernel is, I think, much the same.

Simon Lucy
Thursday, February 13, 2003

Wow, and I always thought it was written in PHP... or can PHP ONLY cure cancer ;)

Damian
Thursday, February 13, 2003

>>>>>>>Windows NT and Windows 2000 are different animals, they are operating systems, Windows isn't, but the windowing kernel is, I think, much the same. <<<<<<<<<

Simon,
            Can you explain the above; it realy doesn't make too much sense to me.

Stephen Jones
Thursday, February 13, 2003

Li-fan Chen: Don't you mean you have family working for Compaq?

Mr. Dude
Thursday, February 13, 2003

>>Li-fan Chen: Don't you mean you have family working for Compaq?

Mr. Dude: Don't you mean HP?

I have a friend who is still upset at Compaq merging DECUS (the DEC users groups) into the Compaq Users Group. He wasn't very thrilled to hear about HP buying Compaq (and putting DEC even further in the grave).

RocketJeff
Thursday, February 13, 2003

Any vb code lurking in the kernel somewhere? <g>

Cletus
Thursday, February 13, 2003

I could have sworn there was some COBOL and FORTRAN stuck around in there somewhere... ;)

Brian Hall
Thursday, February 13, 2003

You're all wrong! It was written in English!

WNC
Friday, February 14, 2003

<Simon,
            Can you explain the above; it realy doesn't make too much sense to me. >

Could be my syntax :-0.
What I meant was that the original Windows and versions up to and including '98 were layers on top of DOS and the separation was quite distinct.

Windows NT, 2000 and XP (I always forget that last one), are more integrated but the underlying operating system kernel is still separate to the windowing kernel.  Now the API is in large part (and in terms of how message queues work, handle structures etc, identical), much the same as the original Windows kernel but the combination is very different to the DOS+Windows releases previously.

Simon Lucy
Friday, February 14, 2003

I still don't get you. Windoows 3.1 was to a certain extent a Windowing manager for DOS, but by the time you've got to W98SE it doesn't seem to make much sense to talk about it not being a fully fledged OS.

With NT it was decided to give the video card and GUI kernel access in NT 4.0 because of performance questions.

It does seem to me that you are confusing the two Windows architectures W9* and NT with Unix GUI systems where the X  Windows manager is running on top of a command line shell.

Perhaps if you could give us some references?

Stephen Jones
Friday, February 14, 2003

Time for a quick(ish) lesson on Windows architecture:

Windows 9x had the same basic operating system architecture as Windows/386 did back in 1988. It used a virtual machine monitor (VMM) which pre-emptively multitasked MS-DOS virtual machines (VMs) and the system virtual machine. The three core DLLs which developers often think of as the heart of Windows - Kernel, User and GDI - ran within the system VM. Applications were co-operatively multitasked within the system VM up until Windows 95, when they were pre-emptively multitasked. MS-DOS within Windows 9x ran in V86 mode, which can be thought of as a one megabyte form of Protected Mode. So Windows 9x did not "sit on top" of DOS, it was more a case of the Windows tail wagging the DOS dog, so to speak.

The Windows NT architecture doesn't use a VMM but uses a microkernel. Microsoft sometimes refer to it as a modified microkernel because for pragmatic reasons it's a bit big to be a pure microkernel. There are environmental subsystems which sit above the NT Executive. One of these is for OS/2 and another one is for Win32. The NT equivalents of User and GDI were part of the Win32 subsystem until Windows NT 4.0, when for performance reasons, they were moved into the Executive. Windows XP still has this architecture, with detail improvements.

John Topley
Friday, February 14, 2003

hey guys i say that win32 programming is followed and i am sure that they have used c in initial stages ,later c++ in kernel and then vc++,......

PUCHA ANIRUDH
Friday, August 20, 2004

*  Recent Topics

*  Fog Creek Home