Используются ли оба ядра в двухъядерном процессоре, когда процессор находится в однозадачном режиме?

289
Isaac D. Cohen

Будет ли ОС, работающая в однозадачном режиме (не многозадачном режиме), использовать преимущества обоих ядер в двухъядерном процессоре?

РЕДАКТИРОВАТЬ: В ответ на первый комментарий: Да, но при загрузке компьютера выполняется только одна задача; загрузчик. Мой вопрос: на этом этапе оба ядра выполняют одну и ту же задачу или могут использоваться только в многозадачном режиме.

0
Я думаю, что вам нужно расширить свой вопрос немного больше. ОС всегда "многозадачна" даже на одноядерном процессоре. Во многом смысл ОС заключается в том, чтобы планировать задачи по доступному времени процессора. Foosh 9 лет назад 1
[Загрузчик] (http://en.wikipedia.org/wiki/Booting) на самом деле не является частью ОС. Ƭᴇcʜιᴇ007 9 лет назад 0
Даже ядро ​​может работать в однозадачном режиме, и это единственная задача. Isaac D. Cohen 9 лет назад 0
https://stackoverflow.com/questions/14261612/which-core-initializes-first-when-a-system-boots - я не знаю, какой код запускает точка доступа (не «загрузочный процессор»), но, скорее всего, просто остановите или заблокируйте в режиме ожидания, пока назначенный BSP выполняет встроенное ПО при загрузке. LawrenceC 9 лет назад 0

1 ответ на вопрос

2
LawrenceC

If you are talking about the standard x86/amd64 PC platform, the following happens on a hardware level when the system is powered on (from here):

In a multicore system, the bootstrap processor is the CPU core (or thread) that is chosen to boot the system firmware, which is normally single-threaded.

At RESET, all of the processors race for a semaphore flag bit in the chipset The first finds it clear and in the process of reading it sets the flag; the other processors find the flag set and enter a wait-for-SIPI (Start-up Inter-Processor Interrupt) or halt state.

The first processor initializes main memory and the Application Processors (APs), then continues with the rest of the boot process. (http://www.drdobbs.com/go-parallel/article/print?articleId=232300699)

So, all processors except the one that "won" the race above will be in a halt state, waiting for the SIPI. If the "BootStrap Processor" never issues a SIPI to the other CPUs (read this), that's the state they will stay in (for example, if you boot DOS, which doesn't know anything about multiple cores, or the APIC, or SIPIs).

So, to answer your question, the other cores will be idle.

Похожие вопросы