12 ms·
24-core CPU and I can’t move my mouse (2017)
- PaulHoule 4y agoMoving the mouse is the worst case scenario for a deep multicore processor because (1) it is a single-threaded latency sensitive task, (2) there are 23 other cores that can grab a lock and prevent the 1 core that matters from doing its job in a timely manner.
- hulitu 4y agoSo the 23 cores are there only to starve the 24th ? Sounds almost human.
- baq 4y agoWhere are the mouse coprocessor equipped computers?
- formerly_proven 4y agoMouse cursors are mostly handled in hardware. GPUs composit the cursor during scanout, so all the OS has to do is calculate the new coordinates of the cursor and tell the GPU about them.
- winter_blue 4y ago> Mouse cursors are mostly handled in hardware. GPUs composit the cursor during scanout, so all the OS has to do is calculate the new coordinates of the cursor and tell the GPU about them. Is this true on modern Linux DEs (e.g. on KDE Plasma)? Is it also true on Windows and macOS?
- the8472 4y agoThis is fairly basic functionality. Windows and wlroots-based compositors have it at least. I'm reasonably certain that other major compositors have it too.
- salawat 4y agoDid you check? I tell my QA people all the time: If you come to me with "I think" or "I believe", it sounds like you've got some reading to do.
- the8472 4y agoI didn't write "I think" or "I believe". If you want to know my epistemic status: I know about windows based on observable surface behavior and bugs related to accelerated cursors, but I haven't looked at the source. I know about wlroots because I saw the pull requests related to that and a flag to disable it in sway. The last statement regarding other platforms was an educated guess based on gfx card history: accelerated overlays are an ancient feature present in a lot of hardware, not some newfangled niche feature. And I'm not one of your QA people.
- jancsika 4y agoJust an FYI-- I tried to get ChatGPT to generate a question as condescending as what you just responded to. It now generally refuses to write anything impolite. The most I could get was to ask it to take an avuncular tone, at which point it did ask you to "spill the beans, kiddo" about these compositors. :)
- formerly_proven 4y agoYou can actually test this pretty easily by monitoring GPU usage. When nothing on the screen changes, GPU usage should be pretty much zero, even at the lowest P-state (because the compositor isn't rendering new frames unless something changed). You can move the cursor around and GPU usage will stay at the same level, but do something that actually requires new frames to be rendered, like for example dragging a selection rectangle on the desktop, and you'll see GPU usage go up a bit. (And if you do the same in applications using GPU-accelerated frameworks you'll often see the GPU rev up a few P-states, for example scrolling in the Steam library list is enough to cause a transition for P2 for me, likewise many websites kick it up to P2 when you move the mouse or scroll). Another way to see how the cursor is not using the regular rendering pipeline is to move a window around. You'll invariably see that the window lags behind the cursor by 1-3 frames. Other ways where this becomes noticeable is when the graphics stack breaks down, but the cursor still works.
- int_19h 4y agoI don't know about other platforms, but in Windows, it had been true >20 years ago, before the desktop was even composited. Some fullscreen games also relied on this functionality, and sometimes you had an option in game settings to switch between hardware-accelerated cursor and manually drawn one (because the former could be buggy with some video drivers).
- bluescrn 4y agoHardware sprites (and presumably interrupts) made the Amiga mouse pointer move fluidly and responsively even when the CPU was busy. No complex graphics pipelines or laggy LCD screens to add further latency back then either.
- mrybczyn 4y agoI do miss aiming a particle accelerator at my brain as a HCI method.
- ilyt 4y agoIt was just form of 2D acceleration. We even see it now, sometimes called "hardware cursor" in various games settings, althought pipeline is much longer. Just that old small hardware had little to no memory protection and very tight integration so stuff like that could be done directly instead of going thru many layers of abstraction
- MauranKilom 4y agoNot sure if you missed the point or I'm missing yours, but the post you replied to points out that CRT displays sound insane in a certain light...
- robinsonb5 4y agoIndeed - it's no deep magic, "all" you have to do is update the sprite's position from within the very same interrupt which reads the mouse counters. Oh, and make sure that nothing involved in that process can be paged out, ever. (The Amiga made sure of that by not supporting virtual memory!)
- Someone 4y agoYou can do it with very little. Prime example: https://www.folklore.org/StoryView.py?project=Macintosh&story=Apple_II_Mouse_Card.txt https://www.folklore.org/StoryView.py?project=Macintosh&stor...; drawing a mouse pointer on an almost stock Apple II, flicker-free because drawing is synced to the vertical blank interval, even though the hardware cannot see when that happens (that part I don’t quite understand; I can see them detecting ‘end of screen’ on an almost blank screen and programming the timer to generate a periodic interrupt at about the screen redraw frequency, but wouldn’t the VBL and the 6522 interrupts drift away from each other over time?)
- HPsquared 4y agoOptical mice themselves can have quite a complicated processor onboard. Luckily the image processing isn't done on the CPU/GPU. I wonder if anyone ever sold a "software optical mouse".
- ycombin23918 4y ago> I wonder if anyone ever sold a "software optical mouse". You could if you really want to... https://8051enthusiast.github.io/2020/04/14/003-Stream_Video_From_Mouse.html https://8051enthusiast.github.io/2020/04/14/003-Stream_Video...
- chrsig 4y agoWith regard to latency sensitivity, with so many cores available, a single core could be dedicated to processing mouse input. Of course, if there's a lock in the way that's held, that's still a problem.
- astrange 4y agoOr if it needs code that’s paged out or all cores are thermal limited or the GPU hung. CPU time usually isn’t the limiting factor.
- PaulHoule 4y agoFor a modern system like Wayland or WDM, the display compositor gets rectangles of pixels from the applications, copies those into a big rectangle it sends to the rasterizer. Just before it does that, it draws on a mouse cursor. It also has to communicate with the applications about what image to draw so you have to deal with multiple threads no matter what. (Unless you go back to the late 8-bit era where the cursor might be a just a hardware sprite that can be moved around by writing a few bytes.)
- Rusky 4y agoI believe the mouse cursor is still often a hardware sprite today.
- db48x 4y agoAlmost 100% guaranteed, but it is still possible for the OS to be delayed in sending it the coordinates. Of course that means that the OS is badly written.
- yamtaddle 4y agoBy these standards, the only well-written operating systems I've ever seen are BeOS and QNX/Photon. Probably iOS (at least, older versions of it) deserves to be on the list, despite mouse use being atypical. Which... yeah, that actually might be true.
- malfist 4y agoHyperthreads aren't real CPU cores, claiming that your 48 hyperthreads were "only" 50% utilized means all the real cores under the hood are fully utilized.
- CoastalCoder 4y ago> Hyperthreads aren't real CPU cores I can't think of a good principled reason to say SMT cores aren't "real". I'm assuming the answer isn't "because they share some computing stuff". What I think you'd call "real" cores also share resources like L2/L3 caches, sometimes DMA engines, etc. And IIRC, each Intel SMT (hyper-thread) unit has its on instruction pointer and (non-SIMD?) register set.
- toast0 4y ago> And IIRC, each Intel SMT (hyper-thread) unit has its on instruction pointer and (non-SIMD?) register set. I believe the SMTs share the register rename storage, which I'd say is the register set more than the 'architectural registers' But I'd say the reason they're not real is because they don't increase the maximum instructions per clock. With many loads, they do increase the average instructions per clock, but they don't let you do anymore work if you've got a fully tuned load that uses all the computing resources.
- eloff 4y agoIn reality you never have a finely tuned load that uses all the resources all of the time. Processors spend a lot of time waiting for memory, so hyperthreading allows for better utilization of compute. It’s rare to have a workload that benefits from turning it off, and in those cases it’s usually because the hyperthread is hurting the cache hit rate enough to offset the gains.
- hinkley 4y agoBoth threads are waiting on the same memory pipeline. The actual performance has always lagged behind the theory
- salawat 4y agoIf I recall, this is mainly caused by the shift to USB as the connector du jour. Since it's a poll centric protocol, under heavy load, system responsiveness decays. Back in the days of P/S 2, where input was interrupt driven, the background tasks would be interrupted by input coming in, ensuring the user could move the mouse around. Now whether they could get the outcome of a click to register is a different story. The click would, but there'd be no guarantee the click handler would execute before background processing resumed, because it'd be considered an event that'd get scheduled after whatever is currently starving the CPU thread.
- dezgeg 4y agoSure, on the wire USB is a polling protocol. But the polling is done by the host controller hardware, which will raise an interrupt just like PS/2 whenever the device responds to the polling as having data available.
- neonbeige 4y agoThe polling by the host controller is still limited to happening once every bInterval period as specified by the device, which for mouse/keyboard will be at least a few milliseconds, v.s. the old school PS2 style mice which would send hardware interrupts straight to the processor.
- dezgeg 4y agoYes, but that sort of 'delay' will be there all the time, with no relation to the system being loaded (like the top commenter is claiming).
- taeric 4y agoThe article is about a bug in process destruction, if I'm not mistaken. The mouse bit is a bit of an aside. More of an obvious symptom that something is wrong. Not that interrupt based input processing didn't have some advantages. Just this shouldn't be one of them.
- spogbiper 4y ago
- 1970-01-01 4y agoTangent: Moving the mouse made Windows 95 faster https://www.pcgamer.com/this-theory-suggests-wiggling-the-mouse-cursor-actually-did-make-windows-95-run-faster/ https://www.pcgamer.com/this-theory-suggests-wiggling-the-mo...
- actionfromafar 4y agoSo it wasn't just my imagination that installers became faster when doing that...
- ArmandTanzarian 4y agoAt 40 this behavior is ingrained in me and influences my behavior while using a computer to this day.
- cassianoleal 4y agoBack in the early 00s my cousin had a modem that would only transfer data if either the mouse or the keyboard was in use.
- randac 4y agoWow, I've never heard anyone else describe that.. but I had the same on Win95 (iirc) after messing about with the COM port setup too much. You could try to load a website and see there was no transmission going on whatsoever.. but then if you grabbed the mouse and moved it around you would instantly see data transfer happening again and the page would start to load.
- paultopia 4y agoAsk me about how my couple-generations-ago ipad pro (just before the M1) sometimes randomly freezes when I try to scroll a pdf...
- Baeocystin 4y agoI hold out forlorn hope that someday my modern workstation will achieve the responsiveness and fast boot times of my Commodore 128. Not joking in the least.
- anikom15 4y agoNot a C64 user, but I did use Apples, Ataris, and IBMs. Booting to BASIC or a cartridge was fast. Booting to a floppy not as much. Reading a tape? That took several minutes.
- dijit 4y agoThe boot was fast on the c64. Essentially instant. It just dumped you into a prompt though, and loading any program was really quite painfully slow.
- jacquesm 4y agoIt could be just as fast if the bios on a PC did absolutely nothing other than initialize the motherboard and a small basic interpreter. A modern bios goes through more cycles during the boot phase of a typical machine than a C64 would see in its entire lifetime.
- anikom15 4y agoIt will be faster actually.
- NikkiA 4y agoOn early IBM PCs (up until around the introduction of the PS/2 anyway) there was a key sequence to boot direct to BASICA, and it was always about as fast as the 8bits were - except that most of the 8bits didn't have the slow memory check that IBM insisted on.
- logicallee 4y agoI have a long break over the holiday and am thinking of putting a software project out. Do you think I should consider making it a priority to code in a fairly low-level programming language (e.g. Rust) without overhead, and count cycles so that most tasks are done within a single screen refresh? I can't make the rest of users' systems more responsive but I could make my own software as fast and efficient as possible. The other alternatives are Python, which would make it easier to ship large features but would come with a large overhead (full interpreter) since it's an interpreted language.
- Pxtl 4y agoFrom reading it over the root cause was in a massively-multiprocess application. In general this is the usual problem of "on windows use threads not processes for ephemeral parallel tasks" right?
- kevingadd 4y agoThere are also just some workloads that will saturate things. If you hit the mmap infrastructure hard enough on Windows you can saturate the kernel and your mouse cursor will stop moving, I managed to do it with a custom key/value store written in C# once I spun up enough threads hitting mapped files at once. I would assume that on win10/11 (this was a while ago) it is harder to saturate a modern machine, though, especially if you lower the i/o priority of your process.
- Oxidation 4y agoCtrl-F in a 10MB PDF in Adobe DC lags when typing while (I guess) it builds the search suggestion index. On an i9 11th gen with over 20000 CPUmark, and 64 GB of RAM. Madness.
- jmrm 4y agoThe only reason I would use Adobe over SumatraPDF is the need to open a PDF that use JavaScript, have 3D content inside, or has to be digitally signed. Probably SumatraPDF is a lot faster because can't do all of those fancy things, but for reading a document and look for some keywords it's absolutely fantastic, and I don't need something better in 99% of the time.
- NobodyNada 4y agoIn the follow-up blog post (https://randomascii.wordpress.com/2017/07/27/what-is-windows-doing-while-hogging-that-lock/ https://randomascii.wordpress.com/2017/07/27/what-is-windows...) he uses a sampler to try to find the bottleneck by looking at CPU instructions, but concludes: > But the main thing I always realize when using this technique is that modern CPUs are weird and confusing. Because CPUs are massively out-of-order and super-scalar it is not at all clear what it means for a sampling interrupt to hit “on” a particular instruction. If an instruction is particularly expensive then samples are more likely to hit “near there” but I’m sure where “near there” actually is: > If there are three instructions executing simultaneously when the interrupt fires then which one “gets the blame”? > If a load instruction misses in the cache and forces the CPU to wait then will the samples show up on the load instruction, or on the first use of the data? Both seem to happen. > If a branch is mispredicted then will the samples show up on the branch instruction or on the branch target? > What’s going on with the expensive cmp instruction on line 24 of the spreadsheet? > If anyone has a good model for what happens to the CPU pipelines when a sampling interrupt happens I would appreciate that. Ideally that would explain the relationship between clusters of samples and expensive instructions. I have a distinct memory of reading a blog post probably 5-ish years ago where someone did just that. The author started with some microbenchmarks of very tight loops, and used some sort of profiler/perf counter tool that measured hit counts for each instruction of the loop. Then, they went into a deep dive into analyzing the instruction throughputs and latencies and dependency chains to demonstrate how bottlenecks at the CPU level manifested as clusters of samples, and how to use this information to optimize the loop. Does anybody else remember this post, and possibly where I can find it? I’ve been in a couple situations where it would have been tremendously helpful, but I just haven’t been able to dig it up.
- formerly_proven 4y agoSounds like the work of Agner Fog.
- turol 4y agoIt was Travis Downs: https://travisdowns.github.io/blog/2019/08/20/interrupts.html https://travisdowns.github.io/blog/2019/08/20/interrupts.htm...
- WalterBright 4y agoI use Thunderbird for my email. Its behavior shows it is a multithreaded program. But often, the mouse and keyboard will freeze and it becomes unresponsive for several seconds. This is indicative of suboptimal partitioning of the tasks into threads. The highest priority thread should be responding to user input. Heck, back in the 1970s, I designed and built a single board computer that was to be a glass tty. There was no way to get that 6800 uP to update the screen fast enough to keep up with characters arriving at 9600 baud. The solution was, whenever the user hit a key, to abandon updating the screen and process the character. Once that process was complete, and there were no more keys in the input, the screen updating was restarted. It worked out great. You simply never noticed this was happening, and you always got crisp response. I did the same thing for the MicroEmacs text editor on the IBM PC. If I hadn't, the editor would lose input and/or have noticeable lags refreshing the screen. P.S. The importance of not losing input was necessitated by using ttys to transfer files across the phone lines and serial ports. You also couldn't touch type if the tty lost key input. P.P.S. The Chrome browser that I use also has problems with freezing on keyboard input.
- spacechild1 4y agoFor me the UI hangs whenever Thunderbird downloads new messages. It seems as if they are doing network I/O on the UI thread - which can't be true...
- WalterBright 4y agoI learned not to touch the keyboard when TB was downloading new messages and running filters. Otherwise it would randomly corrupt the message file, and I'd lose it all. Yes, I filed a bug report with TB. No, they never found the problem.
- jiggawatts 4y agoI stopped using Thunderbird a long time ago because it had a “feature” that would erase all of your email if it detected that your profile was corrupt… … but it has a habit of corrupting profile files on shutdown.
- dang 4y agoDiscussed at the time: 24-core CPU and I can’t move my mouse - https://news.ycombinator.com/item?id=14733829 https://news.ycombinator.com/item?id=14733829 - July 2017 (499 comments)
- andrewstuart 4y agoThis is one of the primary resaons I ditched Windows for Macos. The multitasking on Windows is ridiculously bad. Also, applications that freeze and can't be killed/restarted are simply part of life on Windows. Add to all that, Window slows down over time - again, the periodic reformat and rebuild is part of life on Windows. After I switched to Mac I didn't need to rebuild the operating system essentially ever. Also, the registry - I think the worst idea in all computing. Prior to the registry you plopped a windows application in a location and configured it with an INI file. After the registry the entire operating system and all applications turned into one big ball of chewing gum, glue and hair dredged out of the shower drain. How can Windows have got it so wrong?
- kevmo314 4y agoDid they? My MacBook is much worse at multitasking. In fact the OS I've found to be best at multitasking is Debian/Ubuntu.
- andrewstuart 4y agoCan I ask what model and how much RAM?
- kevmo314 4y ago2019 13" MBP, 16GB. Pretty much anything I do will spin up the fan now. Compiling an app uses so much battery that I get less than an hour of battery life. I've resorted to remote development only, a la Chromebook. My previous laptop was a similar Lenovo X1 Carbon with Debian and wow do I miss it, but I don't have too much of a choice since I do mobile app development :(
- ab-dm 4y agoYeah, the 2019 MBPs were absolute abominations. I spent 5k AUD on a fully kitted out MBP and performance wise it’s one of the worst computers I’ve ever owned. I swore that would be the last Apple computer I ever bought, but then they released the M1s… and they are very good. Would recommend getting an M1 if at all possible. There’s still time to ask Santa for one.
- jwilk 4y agoYou may also like "24-core CPU and I can’t type an email" from 2018: • part 1: https://randomascii.wordpress.com/2018/08/16/24-core-cpu-and-i-cant-type-an-email-part-one/ https://randomascii.wordpress.com/2018/08/16/24-core-cpu-and... https://news.ycombinator.com/item?id=17780127 https://news.ycombinator.com/item?id=17780127 (313 comments) • part 2: https://randomascii.wordpress.com/2018/08/22/24-core-cpu-and-i-cant-type-an-email-part-two/ https://randomascii.wordpress.com/2018/08/22/24-core-cpu-and... https://news.ycombinator.com/item?id=17824575 https://news.ycombinator.com/item?id=17824575 (99 comments)
- w1nst0nsm1th 4y ago24 cores CPU and the guy is still in a wordpress domain name ?
- dm319 4y agoSounds like Windows needs this 200 line kernel patch that sped things up for linux in 2010 [1] "The patch being talked about is designed to automatically create task groups per TTY in an effort to improve the desktop interactivity under system strain." "Tests done by Mike show the maximum latency dropping by over ten times and the average latency of the desktop by about 60 times." [1] https://www.phoronix.com/review/linux_2637_video https://www.phoronix.com/review/linux_2637_video
- tinglymintyfrsh 4y agoThermal throttling, dirty fans, poor process isolation and scheduling, and so forth.
- yazzku 4y agoI fell off the chair when I read the headline. I get that software runs insanely fast on modern hardware and that often, the naive solution works with acceptable performance. But boy -- can we not set the bar as low as "barely responsive"? If your thing doesn't run on a Raspberry PI, it's probably garbage.
- Razengan 4y agoWhy don’t computer architectures have a separate CPU dedicated to the OS/GUI?
- Oxidation 4y agoThis will still not help when the UI CPU is busy-waiting for the application CPU to generate and send the contents of the menu after you click. And if you can asynchronise separate CPUs, you can do it in separate threads on one CPU.
- datavirtue 4y agoWindows?
- psychphysic 4y agoThe trouble is no matter how much fast RAM, how much of a beast of your GPU is. How many threads your CPU has. The UX is as hangy as the laggiest component. That means if the Windows programmers decided that it needs to wait for every HDD to spin up to show you the contents of your start menu you're gonna have a bad time.
- keybored 4y agoMost of my freezes on Ubuntu for me are the complete grind-to-a-halt kind, and they happen because I’ve run out of memory. Then I buy more memory.
- g8oz 4y agoOn the other hand I just installed Chrome Flex OS on a 2011 HP laptop with 4 GB of memory and am in shock at how responsive it is.