
1. Reasons for CPU Usage Over 100% in top CommandIn Linux systems, a process’s CPU usage exceeding 100% in the top command can have multiple reasons.(1) Factors Related to Multi-Core Processors
1. Characteristics of Multi-Core CPUs
– For multi-core processor systems, the top command divides CPU usage by the number of cores and displays it as a percentage. For example, in a 4-core CPU system, if the displayed CPU usage is 400%, the total CPU usage of the system is actually 100%, with each core using 100%/4 = 25%. When a process can utilize multiple cores, its displayed CPU usage may be the sum of the usage across multiple cores, which can exceed 100%. – Some processors support hyper-threading technology, such as certain Intel processors. Hyper-threading allows each physical core to run two threads simultaneously. In this case, the CPU usage displayed by the top command includes both threads for each physical core, so the process’s usage may exceed 100%. For example, if there are 2 physical cores, the maximum load is normally 200% (assuming each core is fully loaded at 100%), but due to hyper-threading, each physical core can have two threads, effectively making the system appear to have 4 logical cores. If a process fully utilizes these 4 logical cores, it may show CPU usage exceeding 100%.
2. Program Utilization of Multi-Core
– If an application is designed to process tasks in parallel and has enough tasks to run concurrently, it may utilize multiple cores on a multi-core system. For example, large data analysis software, like certain components of Hadoop, will distribute tasks across multiple cores for parallel processing when handling massive data. If monitoring this process, its CPU usage may exceed 100% due to utilizing multiple cores simultaneously.(2) Impact of System Processes
1. High Resource Demands of System Processes
– Some system processes may consume a significant amount of CPU resources under certain conditions, leading to an overall CPU usage exceeding 100%. For instance, certain disk I/O scheduling processes may consume high CPU resources during extensive disk read/write operations. Additionally, network-related processes may also consume considerable CPU resources when handling large amounts of network data (e.g., high-concurrency server-side network service programs processing numerous network connections). Furthermore, logging processes may experience spikes in CPU usage when faced with a high frequency of log write requests (e.g., logging for a heavily accessed website), which can increase overall CPU usage and cause other processes to show values exceeding 100% in the top command.2. Cumulative Effect of Background Service Processes
– In Linux systems, besides the processes we see running in the foreground, there are many background processes running silently. These background processes consume CPU resources, and when multiple background processes perform resource-intensive operations simultaneously, their CPU usage may accumulate, causing a monitored process in the top command to show CPU usage exceeding 100%. For example, system update processes, security scanning processes, and other background processes competing for CPU resources may lead to this phenomenon.(3) Resource-Intensive Tasks or Stress Testing
1. CPU-Intensive Tasks
– If the system is running a large number of CPU-intensive tasks such as big data computations or scientific calculations, CPU usage may exceed 100%. For example, during complex encryption and decryption algorithm validation (like performing Advanced Encryption Standard (AES) encryption and decryption operations on large amounts of data) or conducting large-scale mathematical model calculations (such as complex calculations of atmospheric data in certain meteorological models), processes may consume a significant amount of CPU resources. If this process can also utilize multi-core resources for parallel computation, its CPU usage in the top command can easily exceed 100%.
2. Stress Testing Scenarios
– During system stress testing, testing tools may intentionally create high-load situations to detect system performance limits. For instance, using the stress-ng tool for stress testing can create numerous processes and make these processes perform CPU-intensive operations simultaneously, such as creating multiple CPU computation tasks and memory allocation and release tasks through parameter settings, which can significantly increase CPU usage and cause other normally running processes to show elevated usage, potentially exceeding 100%.(4) Data Sampling Errors
– Sometimes, the CPU usage displayed by the top command may be affected by sampling errors, leading to a displayed usage exceeding 100%. The top command periodically collects CPU usage information for statistical display, and this collection process may not be precise due to system complexity and time-slicing choices. For example, sampling over a very short period may capture certain processes’ peak resource usage moments, misjudging the overall CPU usage. Although this error may be slight, it can still result in readings exceeding 100%. In such cases, more accurate tools like sar (System Activity Reporter) or sysstat can be used to monitor CPU usage, as these tools may employ more complex and accurate algorithms for data sampling and statistics.(5) Improper Process Priority Settings
– In Linux systems, processes run at different priority levels. Some processes may be set to high priority (through the nice command or certain important processes set by default), and these high-priority processes will be allocated more CPU resources by the system. If such a high-priority process also has a large number of computational tasks to perform, it may consume a lot of CPU resources, leading to the top command showing its usage exceeding 100%. For example, if certain critical system services (like core service processes in a database management system) are incorrectly set to high priority while facing a large number of concurrent request processes, this phenomenon may occur.2. Common Methods for Handling Processes with CPU Usage Over 100% in top
When discovering that a process’s CPU usage exceeds 100% in the top command, the following methods can be employed for handling it.(1) Identify High CPU Resource Consuming Process Details
1. Use the top Command for In-Depth Analysis
– First, in the top command interface, press the “1” key, which will display the specific usage of each process on each core, helping to accurately locate which core’s process is causing high CPU usage and how much CPU resource it is consuming. For example, if a Java process shows CPU usage exceeding 100% before pressing “1”, after pressing “1”, it may be found that the process occupies a high usage on two specific cores, allowing further analysis of the process’s logic or related sub-thread operations on those two cores. – By using the sorting function of the top command, sort processes by CPU usage (by pressing “P”), allowing the processes with the highest CPU usage to be listed first, making it easier to view specific process information that exceeds 100% CPU usage, such as the process’s PID (Process Identifier), the user it belongs to, memory usage, and other ancillary information, providing more reference for subsequent handling.
2. Combine Other Tools for Auxiliary Viewing
– Besides the top command, the ps command can also be used in conjunction with the grep command to find more detailed information about specific processes. For example, if it’s known that a high CPU consuming process is named “nginx”, the command “ps -ef | grep nginx” can be used to check the startup parameters, parent process, and other details of this process. This is helpful for analyzing why a process consumes high CPU resources, as sometimes unreasonable startup parameters may lead to abnormal process operation, resulting in excessive CPU resource consumption. – Using the pmap command to check the memory mapping of a process, if a process has high CPU usage, it may sometimes be related to its improper memory usage. For example, pmap -x
1. Optimize the Process Itself
– If the application itself has issues, such as a dead loop in the code or an inefficient algorithm causing high CPU usage, for open-source applications, the source code can be reviewed for optimization. If it’s an internally developed program, relevant developers can be found to investigate code issues. For example, in a Java-developed application, a method may lead to a dead loop due to not setting the termination condition correctly, causing continuous CPU resource consumption when this method is called. By reviewing and correcting this code issue, the high CPU usage can be resolved. – For some database-related processes, such as MySQL processes with high CPU usage, it may be due to poorly designed query statements. For example, not writing appropriate indexes may lead to the database needing to perform full table scans during query operations instead of quickly locating data using indexes. This situation can be improved by optimizing query statements and adding appropriate indexes (e.g., using CREATE INDEX statements to create indexes for frequently queried columns), thereby enhancing the database’s query efficiency and reducing the process’s CPU usage.
2. Adjusting Process Priority or Limiting Resource Usage
– Use the renice command to adjust the process’s priority. If a non-critical process is consuming high CPU resources due to high priority, its priority can be lowered to balance system resource allocation. For example, if a backup process is consuming too high a proportion of CPU resources during its operation, affecting other important programs, it can be adjusted using “renice +n
1. Kernel Parameter Adjustment
– Adjusting certain kernel parameters can improve the system’s resource allocation and processing efficiency, thereby impacting CPU usage. For example, adjusting the swappiness parameter controls how aggressively the system swaps memory data to disk swap space. If the system has sufficient memory, the swappiness can be lowered (the default value is usually 60, and it can be adjusted to between 10 – 20) to reduce unnecessary memory-swap disk operations, as frequent swapping can cause the CPU to participate in data transfer tasks, thereby reducing CPU usage issues. Adjustments can be made by editing the “/etc/sysctl.conf” file, adding or modifying “vm.swappiness =
2. Adjusting System Service Configuration
– Check the currently running system services, and stop unnecessary ones. For example, if a computer in a test environment does not need to run a print service (like the cups service), the related service can be stopped to reduce system resource consumption. The command “systemctl stop
1. Increase CPU Core Count or Upgrade CPU
– If the system’s CPU load remains high for a long time and is due to business demands requiring processing of numerous tasks, consider increasing the CPU core count or upgrading to a higher-performance CPU model. For example, for a video editing workstation, if high-resolution video editing tasks are frequently processed and CPU usage is often high, upgrading from a quad-core CPU to an octa-core or more can better meet the demands of multi-task parallel processing, reducing the relative CPU usage of each task and improving overall system performance. Similarly, for enterprise-level servers encountering high CPU usage with increasing business volume, adding CPU cores can effectively resolve the issue.
2. Increase Memory Capacity
– Increasing system memory capacity can also help lower CPU usage. When system memory is insufficient, the CPU spends a lot of time managing memory operations, such as frequently swapping memory data to disk swap space and back. For example, in scenarios where multiple large databases are running simultaneously for data queries and processing, insufficient system memory can lead to increased CPU usage of the database processes. By increasing memory, excessive memory management operations due to insufficient memory are reduced, allowing the CPU to focus on actual business computation tasks and lowering CPU usage.
3. Related Cases: Practical Solutions for High CPU Processes in top
(1) Handling Case of High CPU Usage in Java Process
1. Problem Description – On a web application server, the system administrator discovered that a Java process’s CPU usage consistently exceeded 100% through the top command, leading to noticeable performance degradation of the server, slower web application responses, and user access delays.
2. Analysis Process – First, by pressing “1” in the top command interface, the specific usage of the Java process on each core was checked, revealing that the process was consuming a high usage on two specific cores. The jstack command was then used to generate the thread stack information for the Java process. Analyzing the stack information, it was found that several threads were engaged in lengthy computational operations, and further code inspection revealed that a part of the real-time data statistical function had insufficient mathematical algorithm optimization, resulting in a large number of redundant calculations under high concurrency. Additionally, some threads that had completed their tasks did not release resources promptly, further worsening resource consumption.
3. Solution Measures – Developers optimized the code, improving the data statistical algorithm to avoid unnecessary redundant calculations and adding a thread resource release mechanism to ensure that threads released occupied resources promptly after task completion. After these adjustments, the CPU usage of the Java process dropped back to normal levels, the web application’s response speed returned to normal, and server performance improved.
(2) High CPU Usage Case of MySQL Database Process
1. Problem Performance – On an internal data processing server of a company, the CPU usage of the MySQL database process continuously exceeded 100% under the top command, causing database query operations to slow down significantly and affecting the efficiency of various business systems in obtaining data.
2. Troubleshooting Steps – First, performance analysis tools related to MySQL (like the EXPLAIN statement to analyze query execution plans) were used to check query operations. It was found that many common queries did not utilize indexes and instead performed full table scans. For example, in a query within an order management system frequently querying orders with a status of “shipped”, no index was established on the order status column, forcing the database engine to scan the entire order table to find the data that met the conditions, consuming a large amount of CPU resources.
3. Solution – Indexes were created for commonly queried columns that lacked indexes, such as using the “CREATE INDEX index_name ON table_name (column_name);” statement to create an index for the order status column. After creating the index, the database could quickly locate the data that met the conditions during queries, reducing the CPU computational load in the query process, significantly lowering the CPU usage of the MySQL process and improving the query speed, meeting the data query needs of various business systems.

4. Suggestions on Handling Processes with CPU Usage Over 100% in Professional Forums(1) Suggestions in Oracle-Related Forums for Oracle Processes with CPU Over 100%
1. In Oracle Database Environment – When encountering Oracle processes showing CPU usage over 100% in the top command, first check the overall system status to see if other components also have abnormal conditions. For example, check the operating system’s memory usage, disk I/O, and network status. If any of these aspects show blocking or abnormally high load conditions, it may indirectly cause the high CPU usage of the Oracle process. – Check the CPU utilization of each session. You can query relevant views (like the v$session view) to obtain more CPU usage information related to each session. Compare the CPU usage time of each session to find the session with the highest CPU usage and check its specific situation. For example, if a particular session’s CPU usage is abnormally high, check if the operations it performs involve a large number of hash joins and full table scans. If so, corresponding indexes must be created or checked for effectiveness. For parallel queries, if multiple users execute the same SQL statement simultaneously while parallel queries are running, parallel queries must be disabled or the parallel query hints in the SQL statement must be removed. If queries use intermediate data, limit the use of the intermediate worldlist to reduce total index size.
2. Use Dedicated View Tools for Detection – Use the v$session_longops view to detect long-running operations. This view shows operations that are currently running or have completed. For long-running operations, ordinary queries can only detect related CPU usage after the operation is completed, while this view can monitor the status of long-running operations in real-time, making it easier to identify abnormal CPU usage conditions and make adjustments.
(2) General Suggestions in Linux Technology Forums
1. Use Multiple Monitoring Tools to Confirm Real Situation – Since the top command may have sampling errors, it is recommended to use other monitoring tools for auxiliary confirmation, such as sar (System Activity Reporter), sysstat, and others. For instance, the sar tool can provide comprehensive system activity reports, showing CPU usage, load, I/O, and other information over different time periods. By comparing the results of the top command and the sar tool, a more accurate judgment can be made on whether CPU usage truly exceeds 100% and the extent of the excess. – Once it is confirmed that CPU usage is indeed too high, use the top command to analyze each process’s memory usage in conjunction with CPU usage. Sometimes, a process’s high CPU usage may be due to insufficient memory leading to frequent memory paging operations, causing the CPU to participate in more memory management. In Linux technology forums, this comprehensive analysis method is often recommended to fully understand the process’s status to find accurate handling methods.
2. Recommendations for Unknown Processes – If a process is found in the top command with CPU usage exceeding 100% and it is unclear which normal application corresponds to it, try terminating the process in a safe manner (such as in a test environment or after backing up data). In Linux, the kill command can be used (first attempt to terminate the process gently using “kill -15
5. Steps to Optimize Processes with High CPU Usage Using Tools
(1) Use top and ps Commands to Locate High CPU Usage Processes
1. Initial Viewing and Sorting
– First, use the top command to view the currently running processes and their CPU usage. In the top command interface, press “P” to sort processes by CPU usage, quickly locating processes with excessively high CPU usage and checking their PID, process name, user, and other basic information. For example, if a process named “nginx” shows high CPU usage, its PID can be recorded for further analysis. – To obtain more detailed information about the target process, the ps command can be used in conjunction with the grep command. Continuing with the previous example, if you want to view detailed information about the nginx process, you can use “ps -ef | grep nginx”. This will display more information about the process, such as startup time, command line parameters, etc., which helps analyze the process’s operating status and assess why high CPU usage occurs.
2. View Detailed Thread Information of the Process
– In the top command, press “1” to view each core’s CPU usage details for each process, helping to determine which cores or sub-threads of the process are consuming a large amount of CPU resources. Especially in multi-core CPU systems, this method can more accurately pinpoint the problem. For example, if a Java process shows overall CPU usage exceeding 100% in a four-core CPU system, pressing “1” may reveal that a specific thread group on two cores is consuming a lot of CPU resources, providing direction for further analysis.
(2) Use Performance Analysis Tools for In-Depth Process Analysis
1. For Java Processes, Use jstack
– If a Java process has high CPU usage, the jstack tool can be used. jstack is mainly used to generate a snapshot of the current threads of the Java process, allowing inspection of each thread’s state (e.g., running, waiting, blocked) and the methods called by the threads. For example, if a Java process’s CPU usage exceeds 100%, running “jstack
2. For Oracle Database Processes, Use Relevant View Tools
– In Oracle databases, if encountering high CPU usage of database processes, various view tools can be used for analysis. For example, using v$sqlarea, v$session, v$process, and other views for associated queries to obtain detailed information on high CPU usage processes. Specific queries like “SELECT sql_text, spid, v$session.program, process FROM v$sqlarea, v$session, v$process WHERE v$sqlarea.address = v$session.sql_address AND v$sqlarea.hash_value = v$session.sql_hash_value AND v$session.paddr = v$process.addr AND v$process.spid IN(PID);” (where PID is the PID of the identified high CPU usage Oracle process) can be used to view the SQL statements corresponding to the processes and related session information, helping to identify which operations lead to high CPU usage, such as whether there are many sorts or full table scans.
(3) Optimize Process or Resource Adjustment
1. Code Optimization or Query Adjustment
– If the analysis results indicate that the process’s code logic has issues leading to high CPU usage (like dead loops or unreasonable algorithms in Java processes), developers need to optimize the code. For example, redesigning the algorithm portion that involves extensive data calculations to reduce unnecessary computations or using more efficient algorithms to lower CPU resource consumption. For database processes (like MySQL) where high CPU usage is caused by queries, adjusting query statements or adding indexes is essential. For instance, in a business with frequent queries, if current query efficiency is low and CPU usage is high, redesigning the query statements to utilize indexes and avoid full table scans or creating new indexes for frequently queried columns can improve efficiency, thereby reducing CPU resource consumption.
2. Adjust Process Priority or Resource Limits
– Use the renice command to adjust the process priority. For instance, if a non-critical process is consuming excessive CPU resources, use “renice +n