Thread: Polling vs. Interrupts

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    56

    Polling vs. Interrupts

    Does anybody know any good websites that explain more on Polling vs. Interrupts. I have already googled it but the explainations are limited to one slide/page.

    Thanks

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    depends on the port. If you are talking about high-traffic ports like COM1, COM2 etc then you really should use interrupt driven device driver to get the data as it comes into the computer. If you don't there is a high chance that the program will lose some data. serial port UARTs have very limited storage capacity, newest ones can hold about 16 characters before overwriting data.

    How to do that depends entirely upon the operating system you are using. MS-DOS is different than MS-Windows, which is different than *nix, or Vax.

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    56
    in general, I want to know the advantages and disadvantages of each. The reason why I asked is that I get error messages when testing and it goes away 30 seconds later. This occurs occasionally.
    Last edited by NewGuy100; 09-29-2005 at 03:20 PM.

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    The error message is not related to which method is used. It comes from the program you are running. Its impossible to say what causes the error message without knowing more about the program and seeing some code. Generally, interrupt method is preferred over polling method because of what I mentioned in my previous post.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,531
    Polling:
    A: Easy to write and test
    D: Harder to manage data overruns, lost messages etc if you don't poll often enough

    Interrupt:
    A: Less chance of data loss, but make sure interrupts are not locked out for extended periods
    D: Harder to write and test - all the problems of concurrency come out.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 11-30-2009, 03:32 AM
  2. Hardware interrupts
    By Sentral in forum Tech Board
    Replies: 5
    Last Post: 02-23-2009, 06:46 PM
  3. Linux serial port interrupts
    By danga1993 in forum Linux Programming
    Replies: 1
    Last Post: 04-28-2007, 11:15 AM
  4. Interrupts in PM?
    By VirtualAce in forum C Programming
    Replies: 0
    Last Post: 07-29-2003, 12:20 PM
  5. Mouse Interrupts
    By linuxman132 in forum C Programming
    Replies: 9
    Last Post: 12-26-2001, 11:19 AM