How does multi-cores work

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!
Post Reply
mangaluve
Member
Member
Posts: 110
Joined: Mon Feb 23, 2009 6:53 am

How does multi-cores work

Post by mangaluve »

This is probably a stupid question but here it goes. If I have a computer with multiple cores, how do I tell the computer which core to use for different instructions? Or does the computer take care of all this (I guess i can affect it, if I want to run two threads on two different cores). Suppose I create a small OS, as Im currently doing. Do I have to care about the double cores or will it work anyway (I've only tried it in Bochs).
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: How does multi-cores work

Post by bewing »

The "main" core (called the BSP) boots like normal. All the other cores (called the APs) are basically HLT'ed, until you send them a special interrupt. You have to do a whole lot of work to get the APs to do much at all. To get them to run programs, you need to write a scheduler that chooses which AP to run a process on, and then directs that AP to run the code at a specific memory address.
mangaluve
Member
Member
Posts: 110
Joined: Mon Feb 23, 2009 6:53 am

Re: How does multi-cores work

Post by mangaluve »

Thanks! Using multiple cores isn't something I care for right now, just wanted to make sure that a OS that's written for one core still works
Post Reply