33
eo2875
39d

Remembering a university lecture

Prof: "What are some other downsides of using polling instead of interrupts?"

Student: "The process has to wait until it gets polled."

Prof: "Exactly. When you click Ctrl+W, you want that tab to be closed immediately. You don't want the system to wait a few seconds for those keys to get polled and risk your mom looking at that tab."

Comments
  • 11
    Fun fact: because the browser tab runs on an event loop, ^W is actually polled, although not directly - it's resolved into an event object in a queue which is then polled.
  • 3
    Although I suppose the task queue supports both polled and signal based operation, when the queue is empty the page goes to sleep and when the first element is pushed the queue wakes it up.
  • 2
    This is probably a Joke/Meme, but it's a story so I'll allow it. Plus me caés bien.
  • 5
    @lorentz

    I am not sure you're right.

    The website runs on an event loop. At least its javascript does.

    The browser stands before that. So, when you hit CTRL+W, the browser will check if it's a shortcut that it knows. Failling to find a meaning it will create a javascript event and hand it off to javascript's event loop.

    But the browser if finding meaning in closing the tab. So it just closes the tab.

    The browser itself shouldn't be running on an event loop. It knows true concurrency. I mean, there was a time in which browsers tried to be faster by opening multiple parallel sockets and those must be handled in threats.

    I know very little about how any browser is built, but I do not see why they would go back to event loops when they are in a language with threats.

    I mean I could imagine that there is an equivalent of kill -9 for tabs. Then you would be right.
  • 3
    @TheCommoner282 If ^W just closed the tab you would be right, but there is actually a JS event about closing the page, and the page even gets to contest it with an "Are you sure" popup.
  • 1
    @lorentz

    Okay, yeah, I can see that.
  • 3
    @lorentz

    Ugh, Ctrl W not being forced close irritates me.

    Especially because of so many shitty sites with their 'waaaah don't close meeeee' popups.
  • 1
    @CoreFusionX It has been useful to me in the past, but usually it's pretty pointless, I agree.
Add Comment