news.volyx.in

Why is my CPU usage always 100%? (downtowndougbrown.com)

537 points by pncnmnp · 572 days ago · 143 comments on HN

Article summary

The author of the article is troubleshooting a high CPU usage issue on their Chumby 8 device, which is running a Linux kernel. They investigate the issue by analyzing the kernel's behavior, profiling the CPU, and examining the /proc/stat file. The author discovers that the idle tick counter is not being incremented correctly, leading to inaccurate CPU usage readings. This issue is eventually linked to a configuration option in the kernel, specifically CONFIG_NO_HZ_IDLE, which is similar to a problem experienced by the OLPC project.

Main themes

  • CPU usage issues
  • Linux kernel troubleshooting
  • Embedded systems programming
  • Kernel configuration
  • Timer implementation

What commenters say

  • The issue is likely related to a hardware bug in the CPU, which requires a workaround to read the timer correctly.
  • The problem is not with the Electron framework itself, but rather with the fact that it is another browser instance, which can lead to high memory usage.
  • Modern operating systems are designed to use as much free RAM as possible for caching, making memory usage arguments against Electron applications less relevant.
  • The concept of 'race to idle' is relevant to CPU usage, where the goal is to process tasks quickly and then go to an idle state to conserve energy.
  • The issue at hand is an accounting error, rather than a task scheduling problem.
  • The complexity of reading hardware-based time counters is not unique to this specific CPU, but rather a general challenge in systems programming.
  • The use of Electron for desktop applications is criticized for being overly complex and inefficient, with some arguing that it is a misuse of a browser-based technology.
  • The memory usage of Electron applications can be a significant issue, particularly on low-end machines with limited RAM.