Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 19th, 2006, 9:27 AM   #1
SittingDuck
Programmer
 
SittingDuck's Avatar
 
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 3 SittingDuck is on a distinguished road
Red face How do OSs work on more than one CPU?

Different CPUs have different architectures, right? Like AMD and Intel are similar, but different in the sense of paging, segmentation and so on. So how are operating systems able to run on different CPUs without a seperate release for each CPU?
SittingDuck is offline   Reply With Quote
Old Jun 19th, 2006, 4:22 PM   #2
Yegg
Newbie
 
Join Date: Jan 2006
Posts: 20
Rep Power: 0 Yegg is on a distinguished road
Out of curiosity, which OS does this?
Yegg is offline   Reply With Quote
Old Jun 19th, 2006, 5:36 PM   #3
b1g4L
Programmer
 
Join Date: Dec 2005
Location: SC
Posts: 38
Rep Power: 0 b1g4L is on a distinguished road
Send a message via AIM to b1g4L
Windows / Unix are two main examples

Last edited by b1g4L; Jun 19th, 2006 at 5:51 PM.
b1g4L is offline   Reply With Quote
Old Jun 19th, 2006, 5:56 PM   #4
Eoin
Hobbyist Programmer
 
Eoin's Avatar
 
Join Date: Jun 2006
Location: Ireland
Posts: 152
Rep Power: 3 Eoin is on a distinguished road
When it comes to Linux, the majority of an OS is written in C which is very portable across different architectures I would assumes the bits gluing this portable framework to specific CPUs is quite small and written in Assembly.
__________________
Visit my website BinaryNotions.
Eoin is offline   Reply With Quote
Old Jun 19th, 2006, 6:12 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Portability across different architectures has nothing to do with the OP's question, as different architectures would require different releases. The same executable code can be run on differing CPUs only if the CPUs have compatible machine code for all important and basic operations. If a mostly-compatible machine has a set of instructions that could be used, where another does not, then the ability to detect this situation at runtime and call appropriate code from among a set of available alternative code expressions would be in order.

One presumes you aren't asking about code that runs on VMs, as the VM constitutes a separate release.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jun 19th, 2006, 6:32 PM   #6
hush
Programmer
 
hush's Avatar
 
Join Date: Feb 2006
Location: 127.0.0.1
Posts: 35
Rep Power: 0 hush is on a distinguished road
I’m no Linus Torvalds but here goes my limited understanding of the subject:

The portability that you are referring to here is due in main to the HAL ( hardware abstraction layer) this hides the differences in hardware (including the processor) from the operating system kernel. With these mostly hidden from the kernel it is able to do it job regardless of the architecture.

I believe that the HAL is created on installation. I’m am assuming this because if you install windows and your BOIS does not support ACPI and then you upgrade your BOIS to a one that does support ACPI then you are required to do a new instillation due to the fact that the HAL will no longer function. It also seems logical.

Some operating systems require a specific CPU. an example of this is HP unix, where it will only run on its own proprietary hardware (I believe it is called HP/PA). This does however have benefits- one is with the CPU modes: an x86 running windows may only function within the kernel mode or a user mode, however an os running on proprietary hardware would have more levels. In real terms this means that if an application crashes it is less likely to cause a system wide failure due to the fact that it is running in a less permissible mode within the CPU.

hush
hush is offline   Reply With Quote
Old Jun 20th, 2006, 3:08 AM   #7
SittingDuck
Programmer
 
SittingDuck's Avatar
 
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 3 SittingDuck is on a distinguished road
Ah...
SittingDuck is offline   Reply With Quote
Old Jun 20th, 2006, 10:49 AM   #8
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
There seem to be some mistaken ideas in Hush's post.
Quote:
Originally Posted by Hush
I believe that the HAL is created on installation. I’m am assuming this because if you install windows and your BOIS does not support ACPI and then you upgrade your BOIS to a one that does support ACPI then you are required to do a new instillation due to the fact that the HAL will no longer function.
Your statement assumes that a HAL is an entity that can be created and destroyed. In reality, the HAL is but a portion of the kernel that is shipped on a particular architecture release. There's no reason to give it a fancy name...it's good practice in any case to separate whatever stuff is architecture/os/etc dependant from what is not. It makes perfect sense to do, really. If Microsoft has to port the NT kernel to platform X, they write a HAL that works with it, get a compiler that supports X, and they're done. In a severely simplified sense. The Linux kernel has been ported to a much larger range of architectures, possibly due to the availability of the source. You don't see the mention of "HAL" anywhere, but the principle is the same.

Quote:
Originally Posted by OP
Different CPUs have different architectures, right? Like AMD and Intel are similar, but different in the sense of paging, segmentation and so on.
The OP also seemse to have some misconceptions.
AMD and Intel are companies, not architectures. x86 is an architecture, first around way back when with the 8086, 386 and friends. It just so happens that since then, x86 has become wildly popular...the original IBM PC, for one, followed by the army of clones by various companies. When Microsoft went on to release Windows, it would only make sense to write it for the same architecture as DOS and sell to the same market. The rest is history. x86 processors have dominated the desktop market even until now, with two main manufacturers: Intel, the original creator of the architecture, and AMD, a fairly succesful cloner. But both AMD and Intel's x86 chips adhere to the x86 spec...same registers, behavior, etc. You don't have to have separate software releases for the same architecture, which is why you don't see AMD and Intel versions of software at the store. At least, that's how I interpreted your question. Correct me if I misunderstood.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270

Last edited by Dameon; Jun 20th, 2006 at 11:01 AM.
Dameon is offline   Reply With Quote
Old Jun 20th, 2006, 12:43 PM   #9
Dragon_Master
Programmer
 
Dragon_Master's Avatar
 
Join Date: Jan 2006
Location: Some where
Posts: 74
Rep Power: 3 Dragon_Master is on a distinguished road
I think the others said it nicely, but those cpu's are all part of the x86 family, I believe. They all have similar instructions. So, windows and linux,for example can run on a variety of systems. Each of them, of course has a bunch of options that the others don't. It's pretty simple actually. BTW, I'd like to mention HAL only exists in NT based systems. It wasn't around in the 16 bit windows, windows 95, windows 98, ect...
Dragon_Master is offline   Reply With Quote
Old Jun 20th, 2006, 12:58 PM   #10
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
Yes. That is likely part of the reason the earlier kernels weren't ported off of x86...the change would have likely required a significant rewrite. NT was, in itself, a rewrtie. Off the top of my head, the NT kernel can run on Alpha and x86.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:48 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC