-2

I am confused by how to find the efficiency of a cpu given some information from a sample problem. I have been searching the web, but everything I can find is either too advanced for what I need, or doesn't relate exactly. Given that I cannot find a formula for cpu efficiency using polling, I also cannot find one for interrupt mechanism. I did find something on stackoverflow, but even that was not that helpful to me :/

Say that 1) polling is used on a device that operates at 150 char/sec. 2) the polling loop has 200 instructions and 3) the cpu speed is 2 MIPS. And how would I know how many times the loop is run, and the efficiency?

Given that, how would the interrupt method equivalent be different?

I appreciate any help that anyone can offer, because this is confusing to me and I do not know what to do with those numbers. I did read about Amdahl's law but I can't relate that to this either...

huSh
  • 55
  • 1
  • 10
  • 2 million instructions in a second. 200 instructions to do a check. 150 characters arrive per second. It's an 8th grade word problem. – Zan Lynx Jan 28 '17 at 00:25
  • For the interrupt you need to know the specific CPU's cost for interrupt entry and exit plus your 200 instructions. Think of all those idle instruction slots the interrupt is saving for you. – Zan Lynx Jan 28 '17 at 00:29
  • @ZanLynx Never mind... I didn't see your second post. All I know about the interrupt is that routine is 200 instructions. – huSh Jan 28 '17 at 01:28
  • @ZanLynx and what about efficiency? – huSh Jan 28 '17 at 01:55

1 Answers1

0

When receiving data using polling, you poll the data source in a loop, during which you can't do anything else while waiting for data.

When receiving data using interrupts, you don't need to poll the data source, since the interrupt controller will notify you anyway, and you can do other things while waiting for data.

In short, the problem lies in whether you can do other work in parallel.

glauxosdever
  • 652
  • 4
  • 11