OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 12:38 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How to create a multicore OS ?
PostPosted: Sun May 28, 2017 2:21 am 
Offline
Member
Member
User avatar

Joined: Sat May 20, 2017 1:25 am
Posts: 51
Location: PCI bus: 3, slot: 9, function: 5
I mean who a can enable all the cores and force them to execute instructions ?

_________________
How people react when a new update of your OS is coming:
Linux user: Cool, more free stuff!
Mac user: Ooh I have to pay!
Windows user: Ah not again!


Top
 Profile  
 
 Post subject: Re: How to create a multicore OS ?
PostPosted: Sun May 28, 2017 4:10 am 
Offline
Member
Member
User avatar

Joined: Wed Mar 21, 2012 3:01 pm
Posts: 930
http://wiki.osdev.org/SMP


Top
 Profile  
 
 Post subject: Re: How to create a multicore OS ?
PostPosted: Sun May 28, 2017 4:29 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
Don't force your cores to execute instructions. Ask them nicely; it's only polite.


Top
 Profile  
 
 Post subject: Re: How to create a multicore OS ?
PostPosted: Tue Jun 27, 2017 4:30 pm 
Offline
Member
Member

Joined: Mon Dec 16, 2013 6:50 pm
Posts: 27
Basically:
Computer starts with 1 logical processor, others are halted.
Find the number of cpus by scanning memory for mp structures
Use apic to send SIPI, an interrupt that will wake up the other cpus. When sending sipi, you provide an address that you want your cpus to start executing from.

Once they start executing, setup long mode, setup a timer uaing their local apic and make that timer execute the scheduling function. Now you have tasks running on each cpus note that you task list will be global and all cpus will compete to run a task. A task should not run on 2 cpu at the same time.

The wiki page referenced above is a good start. Intel manuals are your best friend.


Top
 Profile  
 
 Post subject: Re: How to create a multicore OS ?
PostPosted: Wed Jun 28, 2017 12:45 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
The task list doesn't have to be global. You can always set up per-cpu task lists and determine which CPU to run a process on, rather than letting it happen randomly. This can simplify scheduling but it is then up to you to ensure that processes are spread evenly amongst CPUs.

Also, you don't need to use individual timers for each CPU. It's possible to have just one timer running, which then notifies the other CPUs.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 69 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group