Question for Experts !

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
mohitbs
Posts: 1
Joined: Mon Jun 02, 2008 11:59 am

Question for Experts !

Post by mohitbs »

I was wondering that when a new chip is introduced (16bit/32bit/64bit…) (single core/dual core/quad core), what fraction of an operating system has to be rewritten ?

Doesn’t the core functionality, and user interface remain pretty much the same ?

(addition of an additional feature is of course logical).


Theoretically, can a well written os have longevity ?

From what I understand, Win98, Me, 2000, XP are all NT based.

What (other than profits) drives a company to ‘create’ another os that is so drastically different, that huge man-hours are required (to produce it), and the user is forced to migrate ?


Let us keep the device drivers out of this. A third party is responsible for that. (that doesn’t mean that the third parties don’t experience pressure to create compatible drivers).
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: Question for Experts !

Post by suthers »

To change from 16/32/64 bit you need to change re-assemble the instructions to the new length. Though there are differences between memory managements etc... (mainly between 16 and 32), though most processors should be backwards compatible. For multiple procs/cores you need to implement SMP. Though again you a dual core processor can run a non SMP OS, though it would only run on one core...
And yes an OS can be built with inbuilt SMP, that detects the number of cores and scales the number of threads it uses to spread the work between all the cores/procs.
This is possible for new instruction sets/instruction lengths by building in multiple kernels with different instruction lengths and code with inbuilt future instruction inbuilt, witch directs program flow to jmp over it to alternative code if the proc doesn't support it.
Jules
Fusion
Posts: 3
Joined: Fri Apr 11, 2008 4:12 pm

Re: Question for Experts !

Post by Fusion »

mohitbs wrote:From what I understand, Win98, Me, 2000, XP are all NT based.
Windows 98/Me are DOS/9x based not NT based, Windows NT/2000/XP/Vista are NT based.
User avatar
suthers
Member
Member
Posts: 672
Joined: Tue Feb 20, 2007 3:00 pm
Location: London UK
Contact:

Re: Question for Experts !

Post by suthers »

Fusion wrote:
mohitbs wrote:From what I understand, Win98, Me, 2000, XP are all NT based.
Windows 98/Me are DOS/9x based not NT based, Windows NT/2000/XP/Vista are NT based.
Didn't know that...
Jules
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Post by bewing »

There are only a few designs out there for PCs, currently. Let's say there are three. Single Processor, SMP, and NUMA.
You can write your OS to support one, two, or all 3 designs.
If you limit your OS to just one design, it will probably become obsolete.
Single Processor systems are much easier to program for -- but they will almost certainly become obsolete very soon.
If you put enough effort into creating your OS, so that it supports SMP and NUMA also -- then you probably will not have to rewrite anything in your OS for at least a decade.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Question for Experts !

Post by Brendan »

Hi,
mohitbs wrote:I was wondering that when a new chip is introduced (16bit/32bit/64bit…) (single core/dual core/quad core), what fraction of an operating system has to be rewritten ?
Mostly, backward compatibility means the OS never needs to be changed when a new CPU is released (e.g. a new computer will still run "prehistoric" DOS) - it's just a matter of being able to take advantage of new features and/or optimizing.

For example, when the original Pentium 4 was released it wasn't very different (from the OS's perspective) from the Pentium III. It had different performance characteristics (instruction latencies, etc) and had SSE2, but it didn't really matter - the OS developer can wait for compilers to optimize for Pentium 4 before worrying about the different performance characteristics (if they bothered) and SSE2 doesn't need any changes to support if you already support SSE.

The next thing was hyper-threading which could be ignored too, but an OS developer could also optimize schedulers, spinlocks, etc to get better performance from hyper-threading. There wasn't any real rush as it wasn't too different from plain SMP. The same can be said for multi-core and NUMA (they're also close enough to SMP that any changes are for optimization/performance reasons only).

In contrast, long mode was a major change - new/updated toolchain, different paging structures, different protection rules, no v86, etc. I'd assume the compilers took care of most of it, except for the new paging structures and lack of v86 (as most OSs don't use segmentation anyway). The differences in paging structures wouldn't have been too hard to adapt to, but "no v86" can be complicated (e.g. build a full "16-bit emulator" if you want backward compatibility done right). Another thing to consider is some sort of compatibility mode so that existing 32-bit applications still work (including libraries and APIs).

@Bewing: The next change I'm expecting is new paging structures for long mode, so we can have true 64-bit virtual address spaces (currently they're limited to 48-bit). Not because it's needed, but because it'd be good for CPU manufacturer's marketing hype (although it'd be good to reduce the number of levels in the paging structures at the same time - too much indirection isn't so good for performance and RAM footprint/overhead isn't such a big factor anymore). Note: Previously I was expecting changes to 8-bit APIC IDs so we can have more than 255 CPUs in a computer, but that's happened already... ;)


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

IIRC, XP was a failed branch of windows, as they tried to build off of it, but they gave up and used 2000 as a base (or something).

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Win98 is not NT based

Post by DeletedAccount »

Slight correction Win98 is not NT based :lol: .
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Post by jal »

piranha wrote:IIRC, XP was a failed branch of windows, as they tried to build off of it, but they gave up and used 2000 as a base (or something).
YDNRC. XP is based on 2000, and Vista on XP. And guess what? Win7 is based on Vista.


JAL
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Question for Experts !

Post by jal »

Brendan wrote:but "no v86" can be complicated (e.g. build a full "16-bit emulator" if you want backward compatibility done right).
Or use virtualization, but that's hardly less complicated :).


JAL
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

YDNRC. XP is based on 2000, and Vista on XP. And guess what? Win7 is based on Vista.
Well, our sources seem to disagree :wink:

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Post by Colonel Kernel »

piranha wrote:IIRC, XP was a failed branch of windows, as they tried to build off of it, but they gave up and used 2000 as a base (or something).

-JL
I think you mean that Vista started out as a branch of XP, but when they did the "Longhorn reset" (removing WinFS etc.) they moved over to a branch based off Windows Server 2003 instead. It's all the NT kernel though. The internal details of MS' change management system really don't matter to the end users anyway...
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

Yah, I think thats it. It's been a while since I really cared much.

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
einsteinjunior
Member
Member
Posts: 90
Joined: Tue Sep 11, 2007 6:42 am

Post by einsteinjunior »

Actually that depends on the systems programming architecture.
For example,protected mode does not really exist on 64 bit intel processor architecture.That means a lot has to be changed in the operating system architecture.
Apart from that some very few modifications are done such as choosing
a compiler to generate code for the target machine.
Thats all what is needed.
User avatar
mystran
Member
Member
Posts: 670
Joined: Thu Mar 08, 2007 11:08 am

Post by mystran »

Colonel Kernel wrote:
piranha wrote:IIRC, XP was a failed branch of windows, as they tried to build off of it, but they gave up and used 2000 as a base (or something).

-JL
I think you mean that Vista started out as a branch of XP, but when they did the "Longhorn reset" (removing WinFS etc.) they moved over to a branch based off Windows Server 2003 instead. It's all the NT kernel though. The internal details of MS' change management system really don't matter to the end users anyway...
Well isn't WS2k3 essentially XP? Just like WS2k8 is essentially Vista (or well, below Microsoft naming hype I've got Windows 6.0.6000 desktop and Windows 6.0.6001 server in here).

The so called "Windows 2000" was "5.0" and XP was "5.1" and I don't have a W2k3 box right now to check but I think it also said "5.1"? Maybe I remember wrong and W2k3 actually had something that XP didn't but it's really just a naming mess and I bet the desktop and server versions actually come from mostly the same code tree anyway.

There was desktop and server versions of the good old 4.0 as well. For 5.0 they decided calling it 2000 by year would be better and then they got crazy and decided that the desktop versions had to be given some more fancy names?!?

I got a Vista desktop and a W2k8 server here, and while the Vista desktop got accelerated Aero windows and the W2k8 server has Windows classic theme only, they essentially work the same. Prepackaged software and default config is slightly different with Vista having desktop stuff and the server having all sorts of server components.
The real problem with goto is not with the control transfer, but with environments. Properly tail-recursive closures get both right.
Post Reply