Урок телепатической отладки от Рэймонда Чена

Разговоры на любые темы: вы можете обсудить здесь какой-либо сайт, найти единомышленников или просто пообщаться...
tyomitch
Пользователь #1352
Пользователь #1352
Аватара пользователя
 
Сообщения: 12822
Зарегистрирован: 20.10.2002 (Вс) 17:02
Откуда: חיפה

Урок телепатической отладки от Рэймонда Чена

Сообщение tyomitch » 24.03.2005 (Чт) 12:24

http://blogs.msdn.com/oldnewthing/archive/2005/03/21/399688.aspx писал(а):Psychic debugging: Why your expensive four-processor machine is ignoring three of its processors
On one of our internal mailing lists, someone was wondering why their expensive four-processor computer appeared to be using only one of its processors. From Task Manager's performance tab, the chart showed that the first processor was doing all the work and the other three processors were sitting idle. Using Task Manager to set each process's processor affinity to use all four processors made the computer run much faster, of course. What happened that messed up all the processor affinities?

At this point, I invoked my psychic powers. Perhaps you can too.

First hint: My psychic powers successfully predicted that Explorer also had its processor affinity set to use only the first processor.

Second hint: Processor affinity is inherited by child processes.

Here was my psychic prediction:
    My psychic powers tell me that

  1. Explorer has had its thread affinity set to 1 proc....
  2. because you previewed an MPG file...
  3. whose decoder calls SetProcessAffinityMask in its DLL_PROCESS_ATTACH...
  4. because the author of the decoder couldn't fix his multiproc bugs...
  5. and therefore set the process thread affinity to 1 to "fix" the bugs.
Although my first psychic prediction was correct, the others were wide of the mark, though they were on the right track and successfully guided further investigation to uncover the culprit.

The real problem was that there was a third party shell extension whose authors presumably weren't able to fix their multi-processor bugs, so they decided to mask them by calling the SetProcessAffinityMask function to lock the current process (Explorer) to a single processor. Woo-hoo, we fixed all our multi-processor bugs at one fell swoop! Let's all go out and celebrate!

Since processor affinity is inherited, this caused every program launched by Explorer to use only one of the four available processors.

(Yes, the vendor of the offending shell extension has been contacted, and they claim that the problem has been fixed in more recent versions of the software.)
Изображение

Ennor
Конструктивный критик
Конструктивный критик
 
Сообщения: 2504
Зарегистрирован: 18.12.2001 (Вт) 3:58
Откуда: Калуга -> Москва

Сообщение Ennor » 24.03.2005 (Чт) 16:06

4 проца... На тех многопроцессорных машинах, которые подведомственны мне, из-под шелла не запускается практически ничего :). Более того, те сервисы, которые там работают, умеют сами выставлять свои процессорные маски.

Вообще же, как я заметил, многопроцессорность в чем-то аналогична многомониторности - специфику работы в таких режимах учитывают единичные программы. А все почему? Все потому, что отладочные стенды слишком дорогие получаются :).


Вернуться в Народный треп

Кто сейчас на конференции

Сейчас этот форум просматривают: Google-бот и гости: 93

    TopList