Machine-translated by Google. Questions are authored in English.
Top

Discussion

A circular buffer is preferred to a linear one because it

  • A.requires no index arithmetic at all
  • B.cannot overflow however fast the producer runs
  • C.needs no data to be moved when an item is removed
  • D.can hold more items in the same memory

Answer: C

Correct answer: needs no data to be moved when an item is removed

A linear buffer must shuffle its contents down when the front item is taken; a ring simply advances the read index, which is one operation whatever the buffer holds. That makes the cost of insertion and removal constant, which is what an interrupt handler needs.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.