Live data from Hacker News

24-core CPU and I can’t move my mouse (2017)

randomascii.wordpress.com

41–50 of 255 posts

Re: 24-core CPU and I can’t move my mouse (2017)

#41
post #7

Earlier quoted context omitted.

Hardware 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.

I do miss aiming a particle accelerator at my brain as a HCI method.

It 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

Re: 24-core CPU and I can’t move my mouse (2017)

#42

Earlier quoted context omitted.

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.

> 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?

This is fairly basic functionality. Windows and wlroots-based compositors have it at least. I'm reasonably certain that other major compositors have it too.

Re: 24-core CPU and I can’t move my mouse (2017)

#43
post #5

Hyperthreads 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.

Nope, all depends on type of load.

HT is an opimization to context switching but if your code running on both utilizes different parts of core (say one loads some memory while others does some math), you can get speedup that's above savings from not having to context switch.

But early on it wasn't really that well optimized so you might've had OS put 2 threads on 2/1 HT/core while other core sits idle

Re: 24-core CPU and I can’t move my mouse (2017)

#44
I 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.

Re: 24-core CPU and I can’t move my mouse (2017)

#46

I 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.

Can still be done if all you want is a command-line to come up and be responsive. Most folks want web, email, images, and even a bit of security from their computer today. Could always be faster, but I think the days of "bam!" ready are past due to those requirements. Unless the computer is only sleeping, like an iphone for example.

Those things don't preclude responsiveness though. Modern software is sitting on top of mountains of inefficiencies and legacy baggage. This was found just months ago https://arstechnica.com/gadgets/2022/09/20-year-old-linux-wo... "A bit of security" is also quite apt, since there's huge room for improvement there too. I wish I could find a way to get paid to improve all this. Currently I'm only doing it for mobile apps.

Re: 24-core CPU and I can’t move my mouse (2017)

#47

Earlier quoted context omitted.

I 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…

I'd do it in C, but that's just me. If this is a one-person project you can hold you code to a high standard. Clean standard C11 with all warnings turned on (-Wall Wextra Wpendantic Wconversion). Write unit tests. Run them with valgrand/sanitizers. Use clang-format. Build with multiple compilers (GCC/clang/MSVC). ... EDIT Not many hackers on hackernews apparently.

I’m curious as to the upside of C, is it mostly just a familiarity thing?

Holding your own code to a high standard is great, but wouldn’t it be nicer if you could offload more of that into the tooling and spend more time on the problem or making the code even cleaner?

Also as a side note: I always find it funny that a flag that represents all warnings doesn’t actually turn on all warnings.

Re: 24-core CPU and I can’t move my mouse (2017)

#48
post #16
post #11

If 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. T…

Sure, 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.

The 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.

Re: 24-core CPU and I can’t move my mouse (2017)

#49
post #30

Earlier quoted context omitted.

> 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.

> I can't think of a good principled reason to say SMT cores aren't "real". It really depends on your definition of "real", yes you can treat them like "real" independent cores but that's not ideal for performance because under the hood they're not actually independent. Your operating system is aware of this and will often avoid scheduling two tasks onto the same physical core unless it has to. If you have 20 logical…

I did an experiment and effectively proved this to myself many years ago.

I had just upgraded to an i7-3770K (8 threads, 4 cores) from a Core 2 Quad (4 threads, 4 cores). I did a POV-Ray render several times using 1, 2, 4, and 8 threads. 2 was nearly double the speed of 1, 4 was nearly double the speed of 2, but 8 was only about 15% faster than 4.

To ensure I wasn't bottlenecking RAM at that level, I tried again with 2 threads, but forced both threads onto a single core, and it was only 15% faster than 1 thread.

That was all the proof I needed of how you really can't treat two CPU threads as two cores.

That said, I've never personally found an instance where allowing a processes to span all CPU threads actually reduced performance, and I'm not sure I've ever seen a real-world case where it does. It's usually something contrived.

Re: 24-core CPU and I can’t move my mouse (2017)

#50

I 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.

I worked with a brilliant engineer who had previously worked at one of the major hard drive manufacturers. He told me about a project he'd worked where the disk manufacturer had their firmware writers collaborate with low-level OS programmers to significantly speed up modern PC boot times. The conclusion was yes they could technically do it, but they found so many peripherals and device drivers that relied on the boot being slow (either intentionally or unintentionally - e.g. hardware or software race conditions, device drivers not actually making sure the device is ready yet, etc.) that there was "no point."
Post reply on HN