18 ms·
That's because our operating systems treat user input as a soft real time problem when actually it should be a hard real time problem. That's why your window ma
by jacquesm 6y ago
That's because our operating systems treat user input as a soft real time problem when actually it should be a hard real time problem. That's why your window manager sometimes can be unresponsive. I've used a hard real time OS for a desktop for some years and the difference with consumer stuff was extreme. You get used to the computer instantly doing what you tell it to do. None of these half second or longer delays between command and result. It's like magic.
- burlesona 6y agoWhich OS? What is your setup?
- deaddodo 6y agoProbably QNX or VxWorks.
- neilpanchal 6y agoAlso RTLinux kernel: https://en.wikipedia.org/wiki/RTLinux https://en.wikipedia.org/wiki/RTLinux
- monocasa 6y agoRTLinux is soft real time, FWIW.
- rudolph9 6y agoCan you elaborate? The wiki says it combines hard-realtime with soft-realtime. It sounds like it depends how you configure it but this is the first I’ve read of it so I could be mistaken.
- kijiki 6y agoThey're just mistaken, RTLinux is hard realtime. It works by running a tiny real time OS on the bare metal, and then running a Linux kernel as a (lightly) paravirtualized lowest priority task. You write your hard realtime code to run on the RTOS, and then your soft/non realtime code runs on Linux. In this model, your compositor, input pipeline and (at least the UI latency sensitive part of) your applications would have to be ported to the RTOS, which makes this pretty infeasible. But it works really well if you have a some hard-realtime control loop talking to a bunch of non-realtime network IO or UI code. Would be a fun way to build a wifi controlled quadcopter. These days you probably want to use Xenomai, or possibly RTAI.
- monocasa 6y agoYes, I was mistaken. I was thinking of the preempt_rt patches. Thanks for the great writeup correcting me!
- als0 6y agoRTLinux is a special supervisor below the kernel that allows you to run "hard-realtime" programs outside of the Linux environment with a lot of restrictions. Everything within the Linux environment is soft. As far as I can tell, it's not feasible to run the GUI stack in the more primitive environment.
- jacquesm 6y agoQnX is correct.
- tokamak-teapot 6y agoIs it feasible for mortals to get hold of and run QnX as a desktop OS?
- pas 6y agoApparently not really: https://news.ycombinator.com/item?id=24346411 https://news.ycombinator.com/item?id=24346411
- jacquesm 6y agoYou might find an old archived copy of it but nothing that would be very useful if you intend to run a modern browser and other tools like that. For curiosity's sake you could. There used to be a one-floppy installer with the desktop on it, I'm sure you could get that to work in a VM. Lots of screenshots: https://www.operating-system.org/betriebssystem/_english/bs-qnx.htm https://www.operating-system.org/betriebssystem/_english/bs-... Docs: https://www.mikecramer.com/qnx/qnx_6.1_docs/sysadmin/intro.html https://www.mikecramer.com/qnx/qnx_6.1_docs/sysadmin/intro.h... Unfortunately I can't seem to locate any disk images, rumor has it there was a VMWare image floating around.
- foundry27 6y agoAbsolutely. The thing you need to be asking for is a hobbyist license, which might not always be advertised but is very much a thing!
- PeCaN 6y agoI emailed QNX a couple years ago about hobbyist or non-commercial licenses and they replied that they no longer offer them.
- Animats 6y agoIt was once. I still have a machine in the closet with QNX 6.1 and the Photon GUI. It has a version of Firefox so old it's called Firebird. But after Blackberry bought QNX, they made it closed source and no longer self-hosting. Today you have to cross-compile from Windows. Grr.
- pixelface 6y agothis sounds like a really cool way to operate and it would be really interesting if you could expand on your experiences.
- jacquesm 6y agoI worked on a project that used QnX for large volume message transmission via custom telex interfaces. Millions of messages on a good Monday morning. Because I like my development machine to run the same OS as the servers I ended up using it for my daily driver for quite a few years. In the end I liked it so much that when Quantum Software dawdled on their 32 bit implementation that I wrote my own version of the OS. One really neat demo was 250 windows running the size of poststamps with a little bouncing line demo inside them. All still received their 'fair share' of time, all could still be moved around and expanded as though the machine was otherwise idle.
- mjcohen 6y agoAbout as good as the Amiga.
- kjs3 6y agoWould you have that OS you wrote up on github or anything, would you? Big fan of QNX; like to look at OS code.
- jacquesm 6y agoOk. see https://jacquesmattheij.com/task.cc https://jacquesmattheij.com/task.cc That's the scheduler. There are a lot of moving parts to running this code, I may make a little project out of restoring it to life under a VM at some point. Happy reading. Edit: reading it myself, wow, my English was cringe worthy back then. Moving to Canada certainly fixed that.
- kjs3 6y agoAwesome. Thanks. FWIW, I think there's still a place for 32-bit OSes if you never port to 64-bit. Small devices, IoT, or this mc68030 thing I've been building. Lot's of opportunity for fun.
- pier25 6y agoYou mean software vs hardware? Can you elaborate?
- neilpanchal 6y agoIt has to do with the architecture of operating system. Real-time operating systems prioritize and preempt tasks based on their priority value - no matter how inefficient it may be; whereas operating systems such as Windows and Linux try to optimize throughput and speed over event based priorities. More to read here: https://stackoverflow.com/questions/5452371/why-isnt-every-os-real-time https://stackoverflow.com/questions/5452371/why-isnt-every-o...
- jacquesm 6y agoLow latency > high throughput in a real time context.
- joshvm 6y agoI assume it means the user input handler is given a deterministic time slot to do stuff. Regardless of what the operating system is doing, it will always schedule mouse movement (or something along those lines). It's a software implementation (scheduling), but it requires hardware that can support it - usually you need fine-grain control over interrupts. So typically nowadays you see RTOSes on microcontrollers (eg ARM). Maybe more precisely you need access to that fine grain control and that often means getting hold of datasheets that are under strict NDA (eg Broadcom). RTOSes are often found in autopilot and vehicle management systems controlling critical peripherals or safety critical software. More mundanely there are also sensors that will get upset if you don't give them undivided attention for fixed periods of time (or if you interrupt them, they will terminate the transfer). Image sensors are particularly picky about this.
- qppo 6y agoYou can implement hard real-time scheduling using polling instead of interrupts, which is usually faster anyway. It just changes how you measure your tolerance, since nothing is instantaneous, ever.
- acdha 6y agoThis is one of the things I still miss about BeOS. On late 90s hardware, the OS wasn't quite hard real-time like QNX but the worst-latency latency was much better than Windows 10 or MacOS on the latest hardware, even in the presence of heavy resource contention — I remember simultaneously surfing the web, downloading video from a camcorder with a Firewire interface which did not buffer, and compiling Mozilla. The UI latency didn't change at all, and the DV transfer didn't drop a packet — everything else got throttled back as necessary, of course, but that meant that, say, GCC took longer to run rather than impacting what I was doing in the foreground.
- outworlder 6y ago> I remember simultaneously surfing the web, downloading video from a camcorder with a Firewire interface which did not buffer, and compiling Mozilla Did you forget to run the OpenGL teapot? BeOS was magical. I wish I could use Haiku in my desktop today.
- jeffbee 6y agoIt wasn't magic, it just starved everything else whenever you waved the mouse around. In this respect it was no different from Mac System 7, even though the design wasn't the same.
- Gracana 6y agoThat's not true, classic Mac OS used a cooperative multitasking model, where processes had to be friendly enough to yield control back to the system / other processes to allow them to do work. A poorly programmed or greedy process could easily hog the CPU.
- jeffbee 6y agoSystem 7 checked for mouse motion every fraction of a second and if the mouse was moving it would drop everything and draw. It didn't need apps to yield for this to happen.
- copperx 6y agoI've long been of the same opinion. There's nothing that would make me happier as a computer user. Delays in feedback are unacceptable.
- willtim 6y agoI feel like even "soft real time" is too generous for Android.
- grishka 6y agoYeah just try using your phone while Google's updating some crap in the background again... Doesn't depend on the newness of the phone either — this happened on every Android phone I've owned since 2011.
- formerly_proven 6y agoNot limited to Android. On iOS for example Safari loading some ads or whatever causes so much input lag that the keyboard can't keep up and mangles the input completely. And on some websites that one just shouldn't visit without rigorous blockers (ehrm reddit) the device becomes so sluggish to respond that taps on the close button are not registered consistently any more.
- smichel17 6y agoWhat, you don't enjoy the back-button+muscle-memory keyboard/navigation tango?
- OGWhales 6y agoHow about “totally flaccid real time”?
- formerly_proven 6y agoOne of the funniest instances of software intentionally kneecapping itself are compositors. As far as I know compositors universally treat all monitors together as a single surface and just assume that they're synchronized. On Windows, this causes all sorts of hilarious stuttering and hitching. On Linux, compositors just vsync on the slowest display.
- simcop2387 6y agoFrom what I understand, on linux wayland makes it possible to do this properly but I'm not sure that any environment on top of it is doing it. I think it's in a "nice to have" holding pattern for them because there's still so much to do to getting a stable and usable desktop environment there to begin with.
- juergbi 6y agoShould be fixed in the upcoming GNOME 3.38: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285 https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
- phkahler 6y agoI wrote a gtk program in Rust that did all its work in the wrong place. It locked up the ability to move ANY windows on the desktop for several seconds. That's a compositor design issue if ever there was one. Is that going to get fixed?
- rudolph9 6y agoWhat OS do you use? And does the mouse being a ps/2 input vs USB make a difference?
- jacquesm 6y agoRight now I use Linux, unfortunately a series of corporate games left QnX without a window manager and mostly useful for embedded work. But if someone were to do a 64 bit port of it it would be an awesome workstation OS even today. And that's just the UI, under the hood it was very impressive as well. Extremely elegant and well thought out.
- rudolph9 6y agoAre there any open source real-time operating systems?
- jacquesm 6y agoNone with a GUI. I never released mine, and it's so far behind the times now it would take major work to get it ported to the 64 bit era and even then it would still be a C based OS. This would be one way in which the Rust crowd could really make a difference.
- pedrocr 6y agoRedox seems like a big effort that has at least some of the properties you're looking for: https://www.redox-os.org/ https://www.redox-os.org/
- TheCycoONE 6y agoBut Redox is not a real time OS is it? I've not seen it written as part of the design or as a future goal.
- pedrocr 6y ago
- carbocation 6y agoI feel like your comment gives voice to what I wanted to say in the thread about why doctors hate their computers: https://news.ycombinator.com/item?id=24336039 https://news.ycombinator.com/item?id=24336039
- Dylan16807 6y agoMost operating systems and software throw tons of junk into the critical path. I don't believe they're anywhere near soft real time, and I bet soft real time would work pretty well. You can miss a couple deadlines by a couple million cycles each and still have instant response. (And a real-time scheduler isn't enough by itself, the many layers of architecture around handling input events can still be bad even if you're meeting every deadline there.)
- grishka 6y agoAnd in addition to that, there's the problem of some apps doing too much work on the UI thread.
- phkahler 6y agoThat should affect the app, but I have seen it cripple gnome desktop too. That should not happen with Wayland.
- grishka 6y agoI mean, on macOS, when something's using too much CPU, or when there's not enough RAM, the foreground app sometimes freezes as you type and loses half of your keystrokes. That annoys the hell out of me.
- winter_blue 6y ago> I've used a hard real time OS for a desktop Which one?
- jacquesm 6y agoAlready answered, but it was QnX.
- winter_blue 6y agoThank you. (I just noticed the thread where it was answered.)
- anderspitman 6y agohttps://64.ms/ https://64.ms/
- Godel_unicode 6y agoFor the lazy: """In an interactive software application, any user action SHOULD result in a noticeable change within 16ms, actionable information within 32ms, and at least one full screen of content within 64ms."""
- alecmg 6y agoclick Feed - Not Found click About - Not Found to be fair, the empty white not found page did open probably under 64ms...
- anderspitman 6y agoYeah my main site is at apitman.com. I'm in the process of overhauling some plumbing. Haven't decided how to handle situations like this where I have a single post which has it's own domain. Here's the actual post: https://apitman.com/13/#64-ms https://apitman.com/13/#64-ms
- exikyut 6y agoIf there's only one post, and there is low immediate probability to change that anytime soon, "can add additional posts" feels like premature specialization, and I'd probably go have fun with a custom design instead. </subjective_opinion>
- l33tfr4gg3r 6y agoCame here to say this :)
- RandoHolmes 6y agowhat OS are you running as your desktop?
- eternalban 6y ago> That's because our operating systems treat user input as a soft real time problem when actually it should be a hard real time problem. Please expand on your reasoning here. Maybe hard realtime is optimal for a kiosk or appliance, but a general purpose OS treating "user input" as a hard interrupt seems problematic. I see merit in your position if we had a sub-category of "interactive OS" for general purpose end-user devices.
- myko 6y agoWhat is holding Apple / Microsoft / Google back from implementing this in their OSs? Is Fuchsia hard real time? edit: looks like Fuchsia is based on the Wikipedia Overview https://en.wikipedia.org/wiki/Google_Fuchsia#Overview https://en.wikipedia.org/wiki/Google_Fuchsia#Overview
- ece 6y agoUsually with real time OSes in my experience on Linux (preempt rt), throughput performance tends to drop a bit because now the processor is responding to inputs ASAP and so other tasks need to wait. Inputs can be network/file I/O, and user inputs. If the processor is rendering a frame and a network packet comes in, now it needs to respond to the network first, and render the frame after processing the packet. That is a very simplified example on one processor, but there are trade-offs depending on workload/inputs/context-switching is what I'm saying, and measuring latency is step one in trying to optimize for it.
- abrookewood 6y agoWhat OS are you using?
- jacquesm 6y agoRight now using Linux (vanilla Ubuntu LTS).
- sriku 6y agoOh this is so frustrating with today's OSes. While it is easy to see latency as being an issue with media centric applications (gaming, music ..), a mundane impact has been the increase in interactions where you do something like click on a menu item and the menu item item refreshes before receiving the click and then takes it as happening on a different item. The human is still faster than the computer!
- Abishek_Muthian 6y agoI remember reading iOS have been handling touch input interrupts with high priority (vs normal priority in android) along with HW accelerated UI Kit ~ 5 years ago in topics such as 'Why iOS is more responsive than android'; I presume android now does the same or has improved in other ways as the latency in even low-end phones aren't drastically slow when compared with iPhones.
- Solocomplex 6y agoI believe the original Pixel had very high priority for input. It felt so much better than any other non-iPhone I had used before. They were working on it around 2016 for sure. https://www.androidpolice.com/2016/04/04/google-open-sources-walt-a-tool-for-measuring-touch-and-audio-latency-on-android-and-chrome-os/ https://www.androidpolice.com/2016/04/04/google-open-sources...
- na85 6y agoWhich OS was that that you used?
- Ice_cream_suit 6y ago>I've used a hard real time OS for a desktop for some years Sounds interesting enough to try. Which operating system is this ?
- selestify 6y agoI’d like to know too
- justinclift 6y agoThis seems to be the answer: https://news.ycombinator.com/item?id=24346411 https://news.ycombinator.com/item?id=24346411
- denkmoon 6y agoWhat hard realtime OS can be used as a desktop?
- dreamcompiler 6y agoThis is why I still have a soft spot for the original MacOS (before OSX). The hardware was 1000x slower but it felt faster in that it responded instantly to user inputs. And that's because the OS was built from scratch as a nearly hard realtime OS. They built it that way because they had to: The RAM was so small and the hardware so limited they didn't have the luxury of seventeen layers of API cruft between every mouse click and something changing on screen. People put up with slow responses today because many programmers are simply unaware that instantaneous response architectures are possible.
- Aldipower 6y agoI remember the file copy process completely stalling, when I just pressed a mouse button. Is that what you mean? :)
- deleted 6y ago[deleted]
- signal11 6y ago> I've used a hard real time OS for a desktop for some years Was this a QNX variant? I'm wondering how you'd rate iOS, especiallly with the ProMotion displays on the iPad Pro. Do they come close in terms of responsiveness?
- jacquesm 6y agoYes. I don't use a smartphone, I use a dumbphone.
- garfieldnate 6y agoWhat operating system do you use? I'd like to try it out!