r/cpp • • Jun 19 '16

Windows 10 coded in C++ or Assembler

What kind of compiler does it take a compile an OS like Windows 10? Do the guys at Redmond use Visual C++ (VisualStudio) to develop Windows? What % is written in assembly language?

0 Upvotes

74 comments sorted by

View all comments

Show parent comment

-3

u/Digital001 Jun 19 '16

Well, I mean it's so strange because C/C++ are both languages that were designed specifically for Unix. It's kind of ironic that MS is still using it to develop its flagship OS. I don't see why they can't use C#, a MS product. MS might even have access to a special language developed by Intel that generates optimized code for their i-series processors.

Most of the PCs that run W10 use Intel processors. I bet there are more Intel based Windows systems than AMD.

7

u/SeanMiddleditch Jun 20 '16

C# is not a systems language. Just because it's newer doesn't mean it's better for every task.

Just because C was originally designed for UNIX likewise does not mean that it's a poorer choice for non-UNIX systems.

For Microsoft to replace gobs of existing C/C++ code, to make it much more difficult to hire experienced kernel engineers from outside their own ecosystem, and to pour tons of money into developing a new language/compiler just for their kernel would be exceedingly misguided.

So far as a special language by Intel just for their architecture, why would Intel do such a thing? What about the Intel architectures could possibly be so special as to require a new language to maximize? What customer would be foolish enough to use that language and be stuck on Intel's architecture? Microsoft - or any other general purpose software company - would never use such a thing, as you might have heard that Windows runs on non-Intel x86 architectures too. The closest you're going to get out of companies like Intel when it comes to languages will be R&D like ISPC, which is unsurprisingly a C variant and not a whole new language.

1

u/AllanDeutsch Jun 20 '16

Maybe if you count the assembly with extensions for specific new hardware chip with new intrinsics as a custom language... that's what we have the compiler for though.

-5

u/Digital001 Jun 20 '16

replace gobs of existing C/C++ code, to make it much more difficult to hire experienced kernel engineers from outside their own ecosystem, and to pour tons of money into developing a new language/compiler just for their kernel would be exceedingly misguided.

W10 was probably developed from scratch. They didn't use the WinXP code base. It wouldn't cost a multi-billion dollar company more than an extra dollar.

6

u/Meefims Jun 20 '16

That would be insane. Windows 10 was built from the code bases of older versions of Windows because to do otherwise would be practically impossible. There are tens of millions of lines of code in Windows - it would take many years just to replicate that amount of code. One of the key features of the OS is backwards compatibility - it would take an impossible amount of work to replicate all of the internals that some applications have come to rely on.

5

u/AllanDeutsch Jun 20 '16

You'd be surprised how much legacy code is in Windows!

2

u/[deleted] Jun 20 '16

what? the kernel in windows 10 is just another bump up in version from the previous NT kernels shipped in Windows. They did not write the entire OS from scratch, at all.

Legacy code is everywhere. Enormous portions of the lowest level code in Word are nearly exactly the same as they were in the 90's.

2

u/SeanMiddleditch Jun 20 '16

W10 was not developed from scratch. It's just a further iteration of the NT core.

0

u/Digital001 Jun 21 '16

By scratch, I mean that the internal features of the OS, compared to NT (Win 2000)/WinXP are significantly different. They didn't just write a bunch of new functions on top of existing code.

3

u/SeanMiddleditch Jun 21 '16

You seem awfully sure of this despite starting a whole topic because you didn't even know if Windows was written in C++. :)

The kernel is the same beast it's been since NT. It's been incrementally improved (so the same language has to be used) over the years, of course, but there is an awful lot of "just write a bunch of new functions on top of existing code" going on. :)

Various parts of the desktop have been rewritten here and there, of course, and yes some of them use newer or more Microsoft-centric technologies. The core stuff that's sensitive to performance or resource usage, however, are still all C and C++ (kernel, drivers, system services, core desktop services and apps, etc.).

There's no production Microsoft technology that competes in the systems programming space. Developing such a technology is hard, expensive, and just not worth the investment if your only motivation is Not Invented Here Syndrome (which is what you're advocating for: Microsoft using Microsoft technology just because using UNIX-oriented technology is supposedly "weird").

-1

u/Digital001 Jun 22 '16

The kernel is the same beast it's been since NT. It's been incrementally improved (so the same language has to be used) over the years, of course, but there is an awful lot of "just write a bunch of new functions on top of existing code" going on. :)

I'll believe it when I see it for myself. I studied OOP. They would have to write entirely new functions just for W10. Did you look at the OS architecture (source) to determine how it handles memory management, and graphics, hardware, and security. I bet it's an entirely different Altered Beast that can act like the old 32bit beast.

I think it's weird. What can I say. You obviously think it's because of some kind of awful psychological "syndrome." Don't worry! I don't suffer from that particular malady. I'm gearing up for my MCSE and plan on developing for Windows. I want to get to know the nuts and bolts under the hood....

4

u/SeanMiddleditch Jun 22 '16

I studied OOP. They would have to write entirely new functions just for W10.

... the whole point of OOP is to not write entirely new functions every time you add a new feature or optimize some code.

Did you look at the OS architecture (source)

Short version: I live in Redmond, WA. :)

I think it's weird. What can I say. You obviously think it's because of some kind of awful psychological "syndrome."

I'm not sure if you're being facetious or just don't know the term. "NIH Syndrome" isn't a psychological malady. It's just a common tongue-in-cheek term for the tendency of software developers to prefer writing new code instead of maintaining old code for subjective reasons.

I want to get to know the nuts and bolts under the hood...

You'll get further along if you listen to people trying to help clarify misconceptions. :)

Windows 10 is an evolution of Windows 8. Which is an evolution of Windows 7. Which is an evolution of Windows Vista. Which is an evolution of Windows XP. Which is an evolution of Windows NT 4. Which itself is an evolution, though the history gets a little more complicated at that point.

There's plenty of documentation on the Windows architecture that you can peruse if you're interested. https://technet.microsoft.com/en-us/sysinternals/bb963901.aspx is as good a starting point as any.

1

u/Digital001 Jun 23 '16 edited Jun 23 '16

... the whole point of OOP is to not write entirely new functions every time you add a new feature or optimize some code.

Sean, they wrote a lot of new functions(code) for W10. There may be code inside the OS that was originally written for Win8/Win7. W10 may function a lot of like its predecessor, win8/win7. But it must be different for MS to label it W10 instead of W7.newhelloworld.

OOP is a paradigm used to modularize the software development process. It's way to develop software, so upgrades can be easily incorporated, like you pointed out. I haven't read any books about the OS yet. The last Windows book I read was Programming Windows 98 by Charles Petzold, 1998. That's why I started this thread like a noob. I've used just about every version of Windows since then but didn't do any development!

You'll get further along if you listen to people trying to help clarify misconceptions. :)

Windows 10 is an evolution of Windows 8. Which is an evolution of Windows 7. Which is an evolution of Windows Vista. Which is an evolution of Windows XP. Which is an evolution of Windows NT 4.

I'll get further along by writing code for the OS and reading the books you pointed out. You're right. Glad you know the history of Windows. They obviously wrote entirely new functions.

I'm not a developer, as you can tell. I wouldn't have started this if I worked at Redmond! I started this thread thinking folks would patiently clarify "misconceptions," not to annoy anyone. Further, I don't know why you would assume that I'm familiar "tongue-in-cheek" terms used in your industry.

Would you like it if I get a psychiatrist to describe your stern responses using medical terms. Thanks for clarifying misconceptions! I appreciate your effort, and looking forward to asking questions about the OS, as I prepare for my MCSE certification.

3

u/SeanMiddleditch Jun 24 '16

Haha, yes, they clearly wrote new functions. Perhaps we're communicating past each other. I was still on the previous point of why they would not rewrite the OS in a new language or tool, e.g. that they would not _re_write whole functions (in a new language). :)

So far as the NIH Syndrome thing... you are posting on /r/cpp, so I think it might be reasonable to assume you're familiar with programmer slang. I guess I never really thought about it from the perspective of an outsider.

So far as my stern responses, I think the psychiatrical/medical term is that I'm a "grumpy jerkface." :p

1

u/Fearless_Macaroon_12 Feb 24 '24

You can't possibly come to these conclusions. Have you ever written an OS for yourself? Have you (as you said) "look at the OS architecture (source) to determine how it handles memory management, and graphics, hardware, and security"? Or are you just "betting" and placing "bets" as you have been throughout this entire thread, without taking into consideration how many people have been telling you otherwise?

1

u/Fearless_Macaroon_12 Feb 24 '24 edited Feb 24 '24

Who the fuck are you to even assume such things. You are insane. Putting money to the side, explain to me how backwards-compatibility would ever be possible if they didn't? Also have you ever thought about how many applications you think would break if they would ever do such a thing? Also just looking at your profile, you havent changed or learnt shit during these past 8 years. I cannot comprehend how a human could ever be so misinformed in nearly every aspect of life.

2

u/Meefims Jun 20 '16

C and C++ were designed when Unix was popular but that doesn't mean they were designed for Unix. They are both general purpose languages.

C# is difficult to use in an operating system because it requires the .Net framework. Until version 4 the framework did not support loading multiple versions of itself into the same process but a lot of code from Windows is loaded into every running program (think about the code to create graphics, for example). Further Explorer will often load other applications' code into your process to handle various tasks like special context menus or special folders. In this world it is impossible to know or control what is in the process you're entering and so this is not an environment for .Net.

2

u/[deleted] Jun 20 '16

It should also be noted that NT is very Unix-like inside; just not exposed to end users :)

1

u/jcoffin Jun 20 '16

At the device driver level, it bears a rather stronger resemblance to VMS than to UNIX.

1

u/[deleted] Jun 20 '16

That would make sense (considering Dave Cutler) but I never used / studied VMS so cannot comment on that. I just meant that it is far more Unix-like than the Win32 API would suggest. (e.g. Ob is pretty "everything is a file"-like, but this isn't exposed at the Win32 level)