Page 1 of 1

One OS per core

Posted: Wed Mar 19, 2008 4:20 pm
by gzaloprgm
Hi!

I was wondering, if each core of a 'dual core' processor can have its own descriptor tables, registers, but sharing same memory.

Can two different operating systems be executed simultaneously and 'switch' between them using a different page table which maps memory to another place?

Cheers
Gonzalo

Posted: Wed Mar 19, 2008 11:54 pm
by ucosty
If both OS's can negotiate for resources with each other somehow I guess it could work. The problem is that there are no operating systems like that (at least on Intel/AMD platforms). While CPU's can share memory how do you deal with both OS's seperately initialising hardware or dealing with hardware interrupts? Thats why you need some sort of hypervisor in order to multiplex the underlying hardware and arbitrate access.

edit: It just occured to me, while slightly off topic, that a similar idea would be the computer add-in cards that give the user another CPU, more memory and other devices on some sort of bus-attached card. They are sometimes the same processor/arch as the base computer but the ones I have seen have been intel/amd boards for Mac and Sun systems. In fact recently found an AMD K6-2 add-in board (PCI) for a Sun workstation. Useless but slightly cool.

Re: Two OS running on each core

Posted: Thu Mar 20, 2008 4:02 am
by Ready4Dis
gzaloprgm wrote:Hi!

I was wondering, if each core of a 'dual core' processor can have its own descriptor tables, registers, but sharing same memory.

Can two different operating systems be executed simultaneously and 'switch' between them using a different page table which maps memory to another place?

Cheers
Gonzalo
Yes, you can, but I would recommend a general format for accessing hardware and resources. For example, a single kernel that can be accessed by both CPU, that has locking mechanisms, and each CPU/OS would then make a call to access hardware and/or memory resources. The 'kernel' (more of an abstraction layer), would be called, check if it's already in use (using a lock), and then return to the CPU whether the resource is available. Both OS's would have to be aware of each other in some way due to the sharing mechanism (or both OS's would have to have their own resources allocated to them, and others hidden from them), for example, both OS's could be told that they only have 16mb of ram, when the system has 32mb installed, so each get half. And CPU 0 could be told about hard drive 0 on interrupt 14, while CPU 1 is told about hard drive 1 on interrupt 15, so they don't interfere with each other. Of course this would mean that you would need to have 2 full systems in one case with duplicates of everything, which isn't very efficient. But, why would you want to run multiple OS's simultaneously? and if you did want to, which OS's would you be talking about?

Re: Two OS running on each core

Posted: Thu Mar 20, 2008 6:40 am
by jal
gzaloprgm wrote:I was wondering, if each core of a 'dual core' processor can have its own descriptor tables, registers, but sharing same memory. Can two different operating systems be executed simultaneously and 'switch' between them using a different page table which maps memory to another place?
Yes, that's what hypervisors do. They provide an abstraction for the hardware (including the CPUs) and run OSes on top of it. In that case of course the OS is being virtualized and may not be aware it is.


JAL