Adding support for multiprocessor systems for an existing OS

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
rdos
Member
Member
Posts: 3330
Joined: Wed Oct 01, 2008 1:55 pm

Adding support for multiprocessor systems for an existing OS

Post by rdos »

I already have a pretty advanced OS (http://www.rdos.net/rdos), that I have worked on since 1988 from time to time. Back then there were no multiprocessor systems (the 386-processor was very expensive also).

I have kernel-threads and a few synchronization primitives (basically critical sections and signals). Signals should pose no problems for execution on more than one processor, but the critical section primitive must be made multiprocessor safe. How would one implement this on a multicore architecture? I also know that Linux uses spinlocks, but I'm not sure how they work, but they are supposed to be multiprocessor-safe AFAIK.

I also seem to have problems with interrupts in newer PCs. Maybe this is because I only support PIC, and not APIC, and these PCs doesn't support PIC anymore? Some PCI devices also seem to not generate interrupts even if they are supposed to according to the PCI-configuration (OHCI-device).

Where can I find the MP specifications? Are they similar in Intel and AMD processors? Are there a common core that is supported in most CPUs?
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: Adding support for multiprocessor systems for an existing OS

Post by bewing »

rdos wrote: ... but the critical section primitive must be made multiprocessor safe. How would one implement this on a multicore architecture? I also know that Linux uses spinlocks, but I'm not sure how they work, but they are supposed to be multiprocessor-safe AFAIK.
Most people use spinlocks, or closely related locking mechanisms, yes. Brendan and I have a running argument going about spinlocks. I say they are horrifying, non-scalable things that no OS designer or programmer in their right mind should ever use.
For a portion of our argument, see this thread.

If you do a search on this forum on the word "spinlock" you will see example code.

In our wiki, please look at the articles:
Atomic operation
Multiprocessor Scheduling
Synchronization Primitives
Maybe this is because I only support PIC, and not APIC, and these PCs doesn't support PIC anymore?
Yes. Booting on a machine with an APIC requires some slight modification to the boot code.
Where can I find the MP specifications? Are they similar in Intel and AMD processors? Are there a common core that is supported in most CPUs?
The MP specs are obsolete. Useful for a quickie initial test of MP stuff, but not for your "real" version. For the real version, you need to use ACPI. Again, see the wiki.
Post Reply