Register»Forums»How Does an OS Use Multiple Cores
1 posts
How Does an OS Use Multiple Cores
3 weeks, 3 days ago Edited by Lochie on April 23, 2021, 6:01 a.m.
In my research I have found that if you want to use more than one cpu core, you have to interface with the kernel. As I understand it, this is to utilize its scheduler.
However, how does the kernel interface with the cpu cores to create this abstraction?
For example, if I was writing an OS from scratch, what code would I write to utilize multiple cpu cores?
I'm confused because AFAIK there is no assembly instruction to say 'all this code is will be executed on core 1, and all this code on core 2' etc.
Mārtiņš Možeiko
2220 posts / 1 project
How Does an OS Use Multiple Cores
3 weeks, 3 days ago Edited by Mārtiņš Možeiko on April 23, 2021, 7:56 a.m.
Using multiple CPU cores is very different depending on architecture you want to use.

On x86 this is typically done through ACPI tables. These tables are provided by BIOS that informs OS how to use different parts of hardware, including multiple cores. ACPI has pretty complex specification that provides ability to run interpreter on specific bytecode. Yeah, it's crazy - to start modern OS you need to run interpreter.

Anyways, here's a good overview of what you need to do to find out how to enable running code on specific core through ACPI: