Program, Interrupted - Computerphile

Sdílet
Vložit
  • čas přidán 6. 09. 2024
  • In day to day life interruptions are annoying, but in computing they're essential. James Fowkes explains using an Arduino.
    EXTRA BITS: • EXTRA BITS: Program, I...
    Dijkstra's Algorithm: • Dijkstra's Algorithm -...
    Thanks to Nottingham Hackspace
    / computerphile
    / computer_phile
    This video was filmed and edited by Sean Riley.
    Computer Science at the University of Nottingham: bit.ly/nottscom...
    Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

Komentáře • 253

  • @anon8109
    @anon8109 Před 7 lety +223

    - Knock knock!
    + Who's there?
    - The interrupting interrupt.
    + The interru...
    - Just a sec while I deal with something that's suddenly come up.
    - ...
    - Please proceed.
    + pting Interrupt who?

    • @thinkfast8662
      @thinkfast8662 Před 7 lety +3

      HAHAHAH BEST JOKE OF 2017 OMG VERY FUNNY JOHN

    • @umnikos
      @umnikos Před 7 lety +1

      Very funny summary of the video

    • @arooobine
      @arooobine Před 7 lety +3

      Give this person a cookie!!!

    • @adamkatav9752
      @adamkatav9752 Před 4 lety +1

      This is what STI instruction is for

    • @HECKproductions
      @HECKproductions Před 3 lety +2

      that is literally genius

  • @jamesadfowkes
    @jamesadfowkes Před 7 lety +239

    At a few points in this video I said "8 bytes" where I meant "8 bits". Damn it all.

    • @jamesadfowkes
      @jamesadfowkes Před 7 lety +55

      I got nervous and talked too fast.

    • @iAmTheSquidThing
      @iAmTheSquidThing Před 7 lety +69

      +James Fowkes You did seem a bit nervous. But you also seem like a natural teacher who answers questions very clearly. Talking to a camera is always weird and unnerving to begin with.

    • @Shockszzbyyous
      @Shockszzbyyous Před 7 lety +10

      don't worry it happens to everyone :D

    • @arooobine
      @arooobine Před 7 lety +3

      Don't worry I had the video playing at double speed anyway so I just blamed the fast talking on that. ;)

    • @user-iu1xg6jv6e
      @user-iu1xg6jv6e Před 7 lety +1

      I hope it's not you who subscribed to feministfrequency channel.

  • @grantmagee
    @grantmagee Před 7 lety +40

    Goodness! I'm working on a digital art Arduino installation and that attachInterrupt function was EXACTLY what I needed to finish my work. Your timing on this video could not have been more perfect. Thank you kindly!

  • @69k_gold
    @69k_gold Před rokem +17

    I love the fact that James actually showed human demonstration of interrupts throughout the video

  • @DataCab1e
    @DataCab1e Před 7 lety +25

    Show of hands: Who else remembers the days of manually configuring IRQs when installing PC hardware?

  • @ze_rubenator
    @ze_rubenator Před 7 lety +61

    Interrupts are no longer part of Magic The Gathering. They were initially "faster" than instants, but it lead to a whole lot of confusion, so they were scrapped in favour of a stack system.

    • @jort93z
      @jort93z Před 7 lety +2

      man i miss the good old "play as an interrupt."

    • @AndersGustafsson87
      @AndersGustafsson87 Před 7 lety

      Ze Rubenator The blue countetspell deck i no longer viable eh?

    • @ze_rubenator
      @ze_rubenator Před 7 lety +2

      Sure it is, you just have to play the interrupts as if they were
      instants. I believe Counterpell, Power Sink and other cards like them
      are still being printed as instants.

    • @BloCKBu5teR
      @BloCKBu5teR Před 7 lety

      Add 3 mana of any single color to your mana pool. Tapping this artifact can be played as an interrupt aether revolt is awesome btw

  • @DinoWinoSaur
    @DinoWinoSaur Před 7 lety +8

    I just learnt this yesterday in my OS class. Awesome.

  • @romanemul1
    @romanemul1 Před 7 lety +58

    I wish to see video about pointers

    • @cgme7076
      @cgme7076 Před 7 lety +1

      romanemul1 :: Pointers are to access memory, and are a programming concept, not really a concept these guys will upload on. They cover broader topics. Here's a quick intro to points.
      On the left side of an equals sign, when declaring the name of a variable, give the variable the asterisk sign to tell the compiler you want to create a pointer (this will create a variable that can store the address of another variable or the value at that location): looks like: int* p = *anotherVar;
      then, on the other side of the equals sign, the asterisk means "address of" which gives you the literal adress of the variable on the disk: int *myP = *variableAlreadyDeclared
      the ampersan sign is used on the left side, if you are creating a "reference to" variable. what this does, is mimicks the address and value of another variable: int &referenceVar = myVariable (no asterisk for declaration, only variable name)
      now, the ampersan on the other side of the equals sign, is for getting the value, at a memory location. so if you get the address in a previous declaration, all you have to do is use the ampersan, and the value from that address will be stored in this variable:
      recent declaration: int *myPointer = *anotherVariable;
      new declaration: int myCopiedValue = &(myPointer);
      This may look very confusing, so go online and see if you can find an in-depth tutorial (I've found many, so it should be too hard)... HOPE THIS HELPED!

    • @soranuareane
      @soranuareane Před 7 lety +3

      CGMe: I think you have it backwards. & is address-of, * is dereference.
      int x = 4;
      int* ptr_to_x = &x; // Make a pointer to x
      int copy_of_x = *ptr_to_x; // Copy the value of x to copy_of_x

    • @kaizen9451
      @kaizen9451 Před 7 lety

      I was suspicious of the syntax int* p = * anotherVar and tried to compile under Visual Studio 2015 - Visual C++ 19.0 and failed. As far as I'm aware, the legal syntax for pointer declaration and initialization is int* p = &anotherVar?
      *anotherVar is not "address of", & is. In using *anotherVar, you are deferencing the pointer i.e. requesting the value pointed to by 'anotherVar'. But since 'anotherVar' isn't even a pointer you'll get compiler warnings.
      Edit: I also think +romanemul1 request for a video regarding pointers is well justified. After all, we've had search algorithms. Not search as in the broader principles of searching, but Dijkstra's algorithm - a very specific algorithm.
      Edit 2: I also don't think it's justified to call pointers a concept. We have abstract data types which are by definition concepts. Not pointers?

    • @djdedan
      @djdedan Před 7 lety +3

      pointers are memory addresses :-) best way to understand pointers is to do some asm :-)

    • @JuddMan03
      @JuddMan03 Před 7 lety

      BlinkY what if anotherVar is a pointer to a pointer?

  • @probE466
    @probE466 Před 7 lety +4

    5:54 : It very much does not save anything in registers, you push your registers on the stack, build a new stackframe, and then execute your code.

  • @DataStorm1
    @DataStorm1 Před 7 lety +1

    the 500ms "delay" loop, means that the button cannot be read during that 500ms, hence it not always responding, for it was inside the 500ms loop.

    • @hellterminator
      @hellterminator Před 7 lety +2

      Thanks for repeating what was said in the video!

  • @golarac6433
    @golarac6433 Před 7 lety +4

    interupts were heavely used in 8 bits systems. For example, on a NES or C64 you didn't have to check for collision between sprites, the video chip can cause an interrupt when it draws 2 sprites and they overlap

  • @dermartologie
    @dermartologie Před 7 lety +3

    I didn't quite like the explanation. Interrupts are not only used for things that need to be handled fast. A buttonhandler is also a good example for an interrupt service routine, because if you're only waiting for the user to press a button, you can halt the cpu und save power. Also all that "remembering" what the program was doing before is part of the ISR and not build into the CPU except for the program pointer.
    Also Interrupts in an ISR are possible. You need to disable them in the ISR yourself. Well, at least on the platforms I know.

  • @aliedperez
    @aliedperez Před 7 lety +5

    actually, multi-core processors are fairly recent. I remember installing interrupt handlers in ye olde 8086. Those were simpler times indeed...

    • @djdedan
      @djdedan Před 7 lety +2

      nothing simple about 8086 but i agree with the sentiment :-)

    • @aliedperez
      @aliedperez Před 7 lety +3

      I said "simpler", not "simple". And I was referring more to the whole system than the processor itself, compared with current systems. But I see you agree with the sentiment, and I'm glad to have lived such times.

  • @firepower01
    @firepower01 Před 9 měsíci +2

    This is a great demonstration. Definitely helped me understand this concept better.

  • @Tfin
    @Tfin Před 7 lety +14

    Unringing all the notification bells, because YT is spamming me.

    • @Rififi50
      @Rififi50 Před 7 lety +16

      What's the point of these anyway? "Subscriptions" seems to show all uploads of my subscriptions either way.

    • @ericsbuds
      @ericsbuds Před 7 lety +11

      yeah I spent 20 minutes turning on all the bells just to have to go back and spend another 20 minutes turning them all off. fucking miss the old comment notification too. now I get a giant list of notifications at the top and I have to load the video to respond to anyone.

    • @ELYESSS
      @ELYESSS Před 7 lety +2

      I no longer get comment reply notifications anymore

    • @gameking008
      @gameking008 Před 7 lety

      why would you ring all your notification bells?!

  • @stub1116
    @stub1116 Před 7 lety +4

    Nice video, but how does the cpu react with Non-Maskable-Interrupts, when compared to programmable interrupts?

  • @Dracolith1
    @Dracolith1 Před 7 lety +2

    Interruptions of interruptions happen in real-life all the time..... You hear a knock at your door, then on the way to your door your kid jumps out in front of you and starts whining.

    • @karlosdaniel6537
      @karlosdaniel6537 Před 2 lety +1

      That's why the interrupts may have relative priorities.

  • @George__4l5a
    @George__4l5a Před měsícem

    Playfully, congratulations, your Sales Incentive payment confirmation is officially through the magical processing chamber!

  • @Ovenman940
    @Ovenman940 Před 7 lety +4

    Please can you do something on DMA and RTOSes?

  • @network_king
    @network_king Před 7 lety +3

    Is this the same as an IRQ?

  • @orrinnaylor3681
    @orrinnaylor3681 Před 7 lety +1

    Fantastic. Programming tip videos like this are awesome. I would love to see more of them.

  • @FrontalBeep
    @FrontalBeep Před 7 lety +2

    I find it interesting that an "interrupt" sounds so drastic (and it probably was at the time) but nowadays when processors can execute millions of instructions per second (not even talking about multi core/multi thread stuff) it seems trivial.

    • @advice-13
      @advice-13 Před 7 lety +1

      1 GHz = 1 billion instructions per second.
      But you still need interrupts, or you computer would wasting a large chunk of that just checking every possible input.

    • @UntouchedWagons
      @UntouchedWagons Před 7 lety +1

      1Ghz = 1 billion cycles per second, instructions can take multiple instructions

    • @karlosdaniel6537
      @karlosdaniel6537 Před 2 lety

      @@advice-13 You confused clock cycles per second with instructions per second.

  • @vicr123
    @vicr123 Před 7 lety +8

    EDIT: Scratch that... Seems to be answered in the extra bits... Maybe I should watch the whole video (including the outro) first... :)
    -What if, during an Interrupt Service Routine, another interrupt appears? Wouldn't you eventually overflow something? :/-

    • @stoltheds7698
      @stoltheds7698 Před 7 lety +2

      Victor Tran as long as there is enough RAM to remember the state before each interrupt... it shouldn't be a problem. (I gess, I don't know C)

    • @vicr123
      @vicr123 Před 7 lety

      Hand MArshall So a "incoming network info" interior would be placed higher than a "incoming keyboard event" interrupt? What if you have two network cards and one interrupts the other? They all have the same priority :)

    • @joao1982
      @joao1982 Před 7 lety +1

      it possible, but not recommended/best practice. the ISR should handle as fast as possible their routine. and it should be as simple as retrieving bytes and placing those in an auxiliar buffer to be handle afterwards or so, avoiding possible deadlocks on the code, etc.

    • @ChunkyChest
      @ChunkyChest Před 7 lety

      lol I do the same thing no worries

    • @vicr123
      @vicr123 Před 7 lety

      3m0_Wr3ck Good to see it's not just me :D

  • @lunaeclipse5768
    @lunaeclipse5768 Před 2 lety +1

    i remembered the moment, when i was playing video game, dota2
    then my friend plugged his usb drive for charging his phone, then its start to say "Hello, Interrupt"
    i was so angry at that time

  • @ManWithBeard1990
    @ManWithBeard1990 Před 7 lety +3

    Just a quick FYI that has nothing to do with computers, but the whole point of revolving doors is that the inside and outside are never connected. You need that in some buildings because the air inside is at a different temperature, and due to convection a pressure difference between inside and outside will exist at the bottom and the top of the building.

  • @davidsweeney111
    @davidsweeney111 Před 7 lety +1

    This is so cool, Im going to the library to get a book on this! Thanks!

    • @kensmith5694
      @kensmith5694 Před 7 lety

      Yes, it is extremely cool. To keep it simple he left out a bit about returning to the program. The software may decide not to do that right now. It may have all the context information for a different chunk of code and swap to it. This lets you effectively have two programs (or more) on the machine. This is how advanced OSes go back and forth between many tasks to give the effect of them all running.

  • @FyberOptic
    @FyberOptic Před 7 lety +2

    I miss the days when you could hook interrupts and interact directly with video memory and registers. I don't necessary miss segmented memory, though!

  • @JFrameMan
    @JFrameMan Před 7 lety

    how do interrupts actually work on the hardware level? wouldn't the cpu need to poll the button anyway to find out if it should interrupt or not?

  • @arik_dev
    @arik_dev Před 4 lety +1

    Does anyone know if interrupts can get dropped? What happens if the os gets flooded with them in a very short space of time?

    •  Před rokem

      The interrupt controller tracks all interrupt lines (IRQs). For every interrupt line, a bit is set if an interrupt has been triggered on that line but not yet handled. Thus, the ISR is guaranteed to be executed sooner or later after the triggering event, but not necessarily as many times as the interrupt line was triggered.

  • @dreammfyre
    @dreammfyre Před 7 lety +3

    Thank god for programmers.

  • @armornick
    @armornick Před 7 lety +1

    I don't know how Linux and Mac do it, but Windows actually puts all of the interrupt events into a message queue and sends them to every Window that's listening. Modern operating systems don't give user-mode applications direct access to the interrupts.

  • @TechyBen
    @TechyBen Před 7 lety +6

    I've been actively using this little bit of function in my Arduino code. :D
    Now if only I can get it working... ;)

    •  Před 7 lety

      What are you working on?
      Also, if you would like me to, I may be able to assist in locating the error if you share the code. :)

    • @TechyBen
      @TechyBen Před 7 lety

      No the code as much the application. I'm looking at getting the right type of sensor for my needs... then it will be getting the right code for it. I've done proof of concepts, now to tune the two (software/hardware).

    •  Před 7 lety +1

      Electronics and computer science guy here, so the offer still stands.

    • @farrukhsaif108
      @farrukhsaif108 Před 3 lety

      @ nice

  • @Frrk
    @Frrk Před 7 lety

    So I programmed on an arduino last year but I never used interrupts for button presses because you couldn't debounce them in code...could I have used interrupts anyway?

  • @joker28666
    @joker28666 Před 7 lety

    its ironic that you interrupted him saying why you dont want an interrupt to an interrupt at the end of the video, kind of wanted to know. But really useful video!

  • @AndrewReeman_RemD
    @AndrewReeman_RemD Před 7 lety +1

    Great video! Thanks for making it :D

  • @emreproxtr
    @emreproxtr Před 5 měsíci +1

    Thanks Sam Porter Bridges

  • @mbright69
    @mbright69 Před 7 lety +1

    Which model laptop is on the desk there?

  • @solomontan1524
    @solomontan1524 Před 7 lety

    Does the "hardware buffer" the guy mentioned at 3:39 refer to the FIFO buffer?

  • @Bentehest
    @Bentehest Před 7 lety

    Sorry to say this, but I think you should take care of the broken piece of wire in the middle part of row 15 of your board. May I suggest a pair of tweezers? :) 2:46

  • @cgme7076
    @cgme7076 Před 7 lety +1

    I have been an aspiring programmer for a couple years now, and have programmed in several languages, and am currently back to C (for the time being - until I can get an Arduino board), and am also trying to decide on a degree for college. I want to know what type of degree would cover things like this, and allow me to program my own boards.

    • @hellterminator
      @hellterminator Před 7 lety +5

      Computer engineering/embedded system design is what you want.

    • @cgme7076
      @cgme7076 Před 7 lety +1

      Thank you

    • @hellterminator
      @hellterminator Před 7 lety +4

      CGMe You're welcome. Also, speaking of Arduino, if you're tight on money, don't hesitate to get a $5 chines clone from Aliexpress. They hold up well and since Arduino is an open source project designed to bring cheap an easy educational kits to everyone, there aren't any moral issues either (clones are perfectly fine under Arduino's license, as long as they don't use the official logo, that's trademarked). You should only get the official boards if you have the money and want to support the project.

    • @hellterminator
      @hellterminator Před 7 lety +1

      ***** They're really nice for beginners because there are easy to use libraries for pretty much anything and tons of tutorials.
      Also, as an ex-professional embedded system designer I still buy Arduinos because they're a nice all-in-one basic package. The last thing I need when prototyping is messing around with resonators and power circuitry.
      I don't really use anything from the Arduino ecosystem (I do all the coding in Atmel Studio), I just think they make for neat and cheap dev kits.
      They're also pretty nice for making extremely simple one-offs that aren't worth making a dedicated PCB for (because you need like one or two extra components beside the Arduino). A $1.50 Pro Mini clone with a sensor directly soldered on beats leaving breadboards all around the place.

  • @yanfe384
    @yanfe384 Před 7 lety

    What happens, when I have more than 1 interrupt pin? So, if I interrupted my programm with pin 1 and while still in the inerruption routine, Interruption pin 2 fires. Can I interrupt my interruption this way?

    • @yanfe384
      @yanfe384 Před 7 lety

      3 seconds later in the video... ah ok XD

  • @LazyMcCrazy
    @LazyMcCrazy Před 7 lety

    You made it very easy to understand! Thank you

  • @tyr1224
    @tyr1224 Před 4 lety +2

    Have you ever written an interrupt routine?

    • @mikejones-vd3fg
      @mikejones-vd3fg Před rokem

      I did once, it went like this "counter++" it was for a delay thing i was trying to implement with chatgtp's help and it had me incrimenting a counter in the routine, didnt work in the end

  • @TheWeepingCorpse
    @TheWeepingCorpse Před 7 lety

    i wrote my first software sprite ISR in z80 assembler on the zx spectrum in the 80s. the interrupt was in sync with the TVs vertical blank which was at 50hz. good times lol.

  • @AbdullahMohammadOzair
    @AbdullahMohammadOzair Před 7 lety

    is it then possible that the delay of 500ms may actually end up being longer than that, in case where the handling of the interrupt takes more time?

    • @djdedan
      @djdedan Před 7 lety

      usually your interrupt code is small and fast... sometimes you may have time to look up an address and move to a register and that's it... depending on the interrupt, from my exp.

  • @Seegalgalguntijak
    @Seegalgalguntijak Před 7 lety

    Is that a Cinnamon desktop on the Lenovo laptop? Or is it Gnome2/MATE?

  • @orlinzer123
    @orlinzer123 Před 7 lety +1

    Please do video on backpropagation algorithm in neural networks

    • @iAmTheSquidThing
      @iAmTheSquidThing Před 7 lety

      I think they did. With Dr Mike Pound. Also Welch Labs has a great series on that.

    • @orlinzer123
      @orlinzer123 Před 7 lety

      they not

    • @kaizen9451
      @kaizen9451 Před 7 lety

      +or linzer Victor Lavrenko here on CZcams does an excellent series on machine learning. I only wish I had the videos when in uni.

  • @The1wsx10
    @The1wsx10 Před 7 lety

    if you want to time something, how can you subtract the time taken by interrupts?

  • @olasoderlind5685
    @olasoderlind5685 Před 7 lety

    but what if i want more then one interrupt arduino and other chips have only 1 interruption-eble pin

  • @LeRouxBel
    @LeRouxBel Před 7 lety

    Wait a minute, did you use Processing on that video ? At around 1 min, that kinda looked like the Processing editor.

  • @felixblanke8076
    @felixblanke8076 Před 7 lety

    Do you really import Club Mate into the UK? :D
    (Box in the upper left corner, 6:20)

  • @supersu6138
    @supersu6138 Před 3 lety

    Are interrupts bond with OS?

  • @necropola
    @necropola Před 7 lety +1

    Developers should never get away with polling (in userspace) and sleep() should be banned. Don't get me wrong, I like this video, because the micro-controller perspective -- where you don't have the Operating System handling the actual interrupt -- is a good starting point into the area/problems of asynchronous (inter-process) communication.
    It would be nice to see a followup showing how kernel and user space work together when handling events, what a mutex/semaphore is and why select()/poll()/epoll() is such a cool system call.

    • @kensmith5694
      @kensmith5694 Před 7 lety +1

      I would make an exception for a sleep() for over a minute.

    • @advice-13
      @advice-13 Před 7 lety +2

      I think that would be a very bad idea, as it's a long arbitrary length. And would cause a lot of bugs for developers.
      I know Android will throw an ANR (app not responding) if your UI thread takes over 5 seconds to render the next frame. But other threads can sit in the background as long as you want.
      You may want to sleep a thread for awhile, say in a game where you're randomly spawning items on a timer. There are better ways to do that, but it works.

    • @necropola
      @necropola Před 7 lety

      ***** When your program needs to do more than just display/update a clock, i. e. you need to catch some sort of (I/O-)event, using sleep() in a polling loop is wrong.
      I'm beginning to wonder, whether threads have been invented for X Window developers who didn't know select(). ...

    • @hellterminator
      @hellterminator Před 7 lety +1

      ***** I'm beginning to wonder if select was invented for dummies who didn't know how to simply plug their code into the main system loop. /s
      1. Threads are much simpler than select, what's wrong with that?
      2. Most environments won't let you group all kinds of events into a single select (i.e. you can use select to wait on multiple network sockets, but not on a socket or a key press) and even if they did, the resulting code would be a mess.
      3. Select doesn't facilitate preemption. If your program performs some non-trivial computation (like video rendering), it will be completely frozen until that computation finishes. What's that? You want to prepare the next rendering job while the current one is being processed? Tough luck, we removed threads because ***** didn't like them, so you're gonna have to wait.

    • @advice-13
      @advice-13 Před 7 lety

      +hellterminator, Do you keep deleting your comments after people reply to them?

  • @rabreu08
    @rabreu08 Před 7 lety

    Why not go full event based programming?

  • @GuildOfCalamity
    @GuildOfCalamity Před 7 lety +1

    surprised there was no mention of pushing and popping the stack

    • @izimsi
      @izimsi Před 7 lety +1

      GuildOfCalamity That video has so simple explanation, that it actually gives pretty much no information at all.

    • @jamesadfowkes
      @jamesadfowkes Před 7 lety +2

      Thought about it, decided I should keep it as simple as I could.

    • @GuildOfCalamity
      @GuildOfCalamity Před 7 lety +2

      Right, you could've blown minds by getting into instruction pointers.

  • @smegskull
    @smegskull Před 7 lety +1

    are controller inputs in video games interrupts then?

    • @MarkKing1979
      @MarkKing1979 Před 7 lety +1

      smegskull yes

    • @smegskull
      @smegskull Před 7 lety

      Mark King ok. cool. can VBA do interrupts?

    • @kalleguld
      @kalleguld Před 7 lety

      No, interrupts are handled by the operating system. But if you set up your VBA program correctly, the OS will trigger an event when the user presses a controller button.

  • @dims2805
    @dims2805 Před 4 lety

    how to stop the system interrup manually?in a manner?
    pliz

  • @7markhunter
    @7markhunter Před 7 lety +1

    I prefer the idea of increasing the buffer size

    • @xybersurfer
      @xybersurfer Před 7 lety

      yes, i also prefer the idea of accommodating the hardware to fit the conceptual ideas

  • @johnno4127
    @johnno4127 Před 7 lety

    Is this related to something which would happen in the 90's? I remember computers freezing, or appearing to freeze, but when you wiggled the mouse they would come back to life.

    • @kaizen9451
      @kaizen9451 Před 7 lety

      I think that's more to do with CPU lockout that occurred on OS's such as Windows XP et al (I know XP was available in '01 not in the 90's). I remember my uni lecturer talking about the subject and how XP was notorious for locking the CPU. Since true concurrency was not used or commercially available then also? Unless the OS could handle scheduling effectively, your events, such as mouse clicks, were placed into a queue and not processed immediately - leading to freezing.

  • @Sandra__651d
    @Sandra__651d Před měsícem

    Swift and effective reimbursement

  • @DrZygote214
    @DrZygote214 Před rokem +2

    Okay, I have a question. What happens if a different interrupt comes in before the first ISR is finished? How do you guarantee that the system won't be locked out by a swamp of constant interrupts?

    •  Před rokem +2

      There are a few ways, depending on the platform. Typically, interrupts are disabled until the ISR re-enables them (which could happen automatically when the CPU flags are restored when the ISR returns, this is probably the most "atomic" way to do it). Often the ISR also has to tell whatever hardware caused the interrupt that it is done, and that it can now send another interrupt, as the hardware often won't send another interrupt before the previous interrupt has been dealt with. Interrupts may also have priorities. On x86, even if interrupts are enabled on the cpu, the programmable interrupt controller (PIC) will only interrupt any executing ISR (before the ISR has told the PIC that it's done) if the new interrupt is of higher priority.

    • @ivandagiant
      @ivandagiant Před 9 měsíci

      In my class we had levels of interrupts, higher levels could cause a nester interrupt but lower levels would be ignored

  • @felador5959
    @felador5959 Před 7 lety +1

    I'm no expert but isn't there a way of having multiple threads and isn't that more suitable and recognisable by other programmers?

    • @iAmTheSquidThing
      @iAmTheSquidThing Před 7 lety +2

      Yes, but not on a tiny microprocessor like the one in an Arduino.

    • @iAmTheSquidThing
      @iAmTheSquidThing Před 7 lety +1

      +Kenpachi Zaraki As I understand it, though. It wouldn't really be running multiple threads. It would just be simulating it by _protothreading_, switching back and forth between two sets of instructions.

    • @AndersJackson
      @AndersJackson Před 7 lety +1

      ***** well, Arduino is not one of those systems. And it add complexity on a low performance unit.
      It is a reason that Multics didn't become a commercial success...

    • @AndersJackson
      @AndersJackson Před 7 lety

      ***** yes, so what?
      This video was about that hardware and libraries...

    • @xybersurfer
      @xybersurfer Před 7 lety

      if there are multiple threads then there is thread switching, and if your thread was not the one running then it could have missed the signal. it's not so much about doing multiple things at the same time. it's more about the guarantee of not missing a signal.
      also by introducing multiple threads it becomes very hard to give guarantees about the time it takes the system to respond (a.k.a. real time). which is a lot of times important for embedded devices

  • @Steven-j1Steven__58c2
    @Steven-j1Steven__58c2 Před měsícem

    Be part of an exclusive interview with the CEO of Binance to gain insights into future developments

  • @OmarAbdElkareem
    @OmarAbdElkareem Před 7 lety

    please, can you make an english subtitle for your videos ? 😢

  • @ZipplyZane
    @ZipplyZane Před 7 lety +1

    Suggestion: instead of putting the cards on top of the videos, why not put the videos down below the cards? You've got plenty of room!

  • @SKyrim190
    @SKyrim190 Před rokem

    Who else was looking at the green LED and going "what is he talking about, this is not flickering at all?" for a while?

  • @ADRIANNORMANNINA
    @ADRIANNORMANNINA Před 7 lety

    Nice Video!

  • @kaizen9451
    @kaizen9451 Před 7 lety

    I'm assuming the interrupt code used in this example was a 3rd party library?

    • @jamesadfowkes
      @jamesadfowkes Před 7 lety +1

      Yeah, Arduino takes care of all of that for you.

    • @kaizen9451
      @kaizen9451 Před 7 lety

      OK interesting, thank you. I had a uni project which required similar characteristics of the Arduino as was demonstrated in this video. Though as far as I was aware at the time, Arduino had no native programmable interrupts. I relied on polling for demonstration purposes.

  • @alecclews
    @alecclews Před 7 lety

    Ow! I never knew Arduino processing supported creating ISRs. I'll have me some of that...

  • @AmolGautam
    @AmolGautam Před 5 měsíci +1

    nice

  • @hieil650
    @hieil650 Před 7 lety

    that's uncomfortable to watch, and I'm understanding

  • @minutebrainperson8324
    @minutebrainperson8324 Před 7 lety +1

    I like the, title.

  • @jamesyu1093
    @jamesyu1093 Před 7 lety

    *British* spelling: _programme_
    _American_ spelling: program

  • @voiceoftreason1760
    @voiceoftreason1760 Před 6 lety

    I would have made screenshots of the arduino program for this video.

  • @NakushitaNamida
    @NakushitaNamida Před 7 lety

    -Please make some efforts for pronunciation , a lot of computerphile viewers are not from an english speaking country and i had a lot of trouble understanding you. Anyway thanks for the efforts-
    [EDIT] finished the video , it just seems James Fowkes is just not at ease with a camera pointed toward him. With some focus i managed to understand everything .

  • @Kal3it
    @Kal3it Před 7 lety

    Please add spanish subtitles :(

  • @slendi9623
    @slendi9623 Před 5 lety

    the only problem i have with my os, is idk how to handle keyboard

  • @touisbetterthanpi
    @touisbetterthanpi Před 7 lety

    Isn't Linux built on interrupts?

    • @jpratt8676
      @jpratt8676 Před 7 lety

      David Sullivan Most OSs have a concept of interrupts because they manage complex hardware. It is not OS specific

  • @Steven-j1Steven__58c2
    @Steven-j1Steven__58c2 Před měsícem

    Join us for an exclusive interview with the CEO of Binance for insights into future developments

  • @rkpetry
    @rkpetry Před 7 lety

    "Interrupts" are exactly what they sound like: crude mismanagement of task scheduling in an obviously multitask environment, by 'bullying' the CPU into excessive make-work-action-administrative processing resulting in thrashing and clock-heating and ultimately exposure of vulnerabilities culminating in security breaches....

    • @balala7567
      @balala7567 Před rokem

      Would you rather:
      -Check the time every second to see if it's time for something
      *or*
      -Set an alarm for that thing

  • @ivuldivul
    @ivuldivul Před 7 lety

    Upvote if you tried to mask non-maskable interrupt.

  • @DanDart
    @DanDart Před 7 lety

    Irony as loading bar at 0:02

  • @RandomNullpointer
    @RandomNullpointer Před 7 lety

    The Kripke accent :)

  • @Brutaltronics
    @Brutaltronics Před 7 lety

    oh damn arduinos everywhere!

  • @linuxisstillthebest6863

    I haz the same raspberry Pi and the same pinboard :)

  • @notsoverflow
    @notsoverflow Před 7 lety

    algo helper comment

  • @divasimao5290
    @divasimao5290 Před 7 lety

    It seems that some of you like gnome classic :)

  • @jaymalby
    @jaymalby Před 7 lety +2

    Second!

  • @tankmohit
    @tankmohit Před 7 lety

    +1 for gnome

  • @goldchalice
    @goldchalice Před 7 lety

    I've never heard of the term "Interrupt". What the programmer in the video seems to describing is Event handling? I take it "Interrupts" are a very low level concept.

    • @peterlinddk
      @peterlinddk Před 7 lety +2

      Interrupts are what happens in the hardware. Event handling is how the software (higher level languages, and APIs mostly) handles those interrupts. The main difference is that the event handling is not necessarily driven by interrupts, but could be done by polling - your program wouldn't know the difference.

  • @nysonrizqi1428
    @nysonrizqi1428 Před 7 lety +3

    first one!!

  • @garbagegamer6198
    @garbagegamer6198 Před 7 lety +2

    First dislike

  • @yepperdeedooda
    @yepperdeedooda Před 7 lety +6

    I'm pretty sure you need to be really smart to even kind of understand this. I love trying to fix things on my own, but this is way too smart for me.

    • @LazyPanda21
      @LazyPanda21 Před 7 lety +16

      3rd year Electronics engineer here
      It's actually one of the easiest concepts to understand and apply while studying microcontroller architecture, and we had to do it using Assembly

    • @assalane
      @assalane Před 7 lety +22

      you need to learn programming and how computers work. Saying "you need to be smart" do to anything is just an excuse

    • @yepperdeedooda
      @yepperdeedooda Před 7 lety

      Azthecx yeah, too confusing. I just learned what an integer was. But I still want to be able to fix my computer. My battery swelled up and it's dead now and I need to have it plugged in for it to work.

    • @yepperdeedooda
      @yepperdeedooda Před 7 lety +7

      assalane I am taking a computer science class though.

    • @valentinidk6101
      @valentinidk6101 Před 7 lety +3

      Ксения Ковалевская​​ ... an integer... are you serious? i honestly think you shut quit this already

  • @101m4n
    @101m4n Před 7 lety

    This guy looks a bit like ricky gervais...
    Hate that guy.