What does Arduino do every 1ms?

i tried to see how fast an Arduino processes a loop:

void setup() 
{
  // put your setup code here, to run once:
  pinMode(2, OUTPUT); 
}

void loop() 
{
  // put your main code here, to run repeatedly:
  static uint8_t n=B00000000;

    PORTD = n;
    n = ~n;
}

I get about 667 kHz (0.74 microseconds) pulse but
I see every 1 ms there is a gap (about 6 microseconds) in the pulse

Is this the interrupt that updates millis() ? does it do something more?
If it's for millis, why don't i see an similar gap for micros()?

I'm not sure of the answer although someone here will help, but your query lead me to wonder what would be the result if you used the bitwise XOR (^) rather than the bitwise NOT. It could toggle only the one bit you are interested in...

Timer 0 overflow interrupt. It's the interrupt that drives micros / millis.

I knew it drives millis(). Does it also drive micros()? I got the impression that when your code reads micros(), one of the hardware timer/counter registers is read directly.

I also wonder what happens when loop() terminates. I suspect it checks for received serial characters and buffers them. Maybe the same for i2c and SPI. What else happens?

I also wonder what happens when loop() terminates. I suspect it checks for received serial characters and buffers them. Maybe the same for i2c and SPI.

No.
You can LOOK, you know...
Arduino Core Source Code

PaulRB:
Does it also drive micros()?

Correct.

PaulRB:
I got the impression that when your code reads micros(), one of the hardware timer/counter registers is read directly.

Also correct.