Using Inter Processor Interrupt

Principle of training : there is no such thing as a stupid question. The basic idea is that people learn by asking. I was asked: "Can you show and explain at the programming level what will happen badly if each task can fulfill all the instructions."

I gave the code

    main(){
      _asm_("cli;");
      while(1);
    }

and explained this (the system was frozen for good use)

Then they asked me: "Is it possible to give an example so that the system does not freeze, even these cleaning interruptions are done?"

I modified the previous example:

I gave the code

    main(){
      _asm_("cli;");
      i=i/0;
      while(1);
    }

and explained it.

: , = i/0 first ( ), , .

UP. SMP? , . :

    int i;
    main(){
    for(i=0;i<100;i++)// Suppose we have less than 100 CPUs
       if(fork())
        { sleep(5);//The generating task has (most probable) time to do all forks
         _asm_("cli;");
         while(1);
        }
     }

, .

, : , , , DMA, fork..... () , SMP.

CPU ? re_schedule() IPI. ? , CPU , . , , .

: Inter Processor Interrupt (IPI) ? "" ?

. . . ( maskable, guess).


- ? , , :

(HW , - " " ). , , , .

Linux? ? ​​Linux .

Linux? (!) x86/x86-64 , " NMI ". NMI , "0" /proc/sys/kernel/nmi _watchdog. - 5 , APIC (cpu )! (SCC Linux - NMI.)

( ) ! . , .

, NMI ? ?

+5
1

, .

push $0
push $0
lidt (%esp)
int $42

reset x86. :

  • IDTR (IDT) 0 .
  • 42, , 1 IDT.
  • , 13. , 13 .
  • , 8. , 8 IDT.

. , , . reset, .

, . , , , , . , .

, - , -, . - , .

0

All Articles