# CPU Issues
- CPU will throttle upon overheating
- `lscpu` shows CPU details ![[images/Pasted image 20250801193911.png]]
- `mpstat` shows snapshot of stats for CPUs ![[images/Pasted image 20250801193925.png]]
- `nice` manages scheduling priority or number of CPU time slices alotted to processes
- functionally prioritizes/de-prioritizes processes
- `ps -eo pid,comm, ni` shows command and nice values for all PIDs, sorted in order of PID
- -20 is highest nice priority, 19 is lowest nice priority
- `renice` alters nice value for running process
`renice -n -2 -p 987` alter nice value for PID 987 to -2
- `sudo nice -n 5 ./test.sh` spawns process associated with test script with a nice value of 5
- `dmesg` shows kernel log entries
- pipe to `tail` or `more` or `less` for readability ![[images/Pasted image 20250731095753.png]]
- `ps aux` shows running processes for all users including daemons ![[images/Pasted image 20250731095659.png]]
- columns for CPU and memory utilization, helpful to compare against a baseline
- typically sorted based on PID
- pipe to `more` or `less` for readability
- `top` shows top processes in real-time based on selected filter
- filter/column for PID, nice value, CPU utilization, and memory utilization
- `q` to quit
- `d` to change update delay
- `uptime` shows machine uptime and load averages over 1, 5, and 16 minute intervals![[images/Pasted image 20250731095614.png]]
- `time app_name` shows amount of time it takes for program to run ![[images/Pasted image 20250801193812.png]]
- `sar -u` shows CPU usage stats
# Memory Issues
- `free` shows memory statistics ![[images/Pasted image 20250801194002.png]]
- `vmstat` shows virtual memory stats
- can be used to analyze jobs in processor run queues ![[images/Pasted image 20250731095602.png]]
- `cat /proc/meminfo` includes more detailed memory statistics ![[images/Pasted image 20250801193843.png]]
- `ulimit` can be configured to limit memory available to particular users ![[images/Pasted image 20250803133339.png]]
- -a for current users settings
- -e for maximum nice value
- -t max CPU time allotted
- -u max number of parallel processes
- -v for size of virtual memory
- -R max time process can run before being blocked
- -T max number of thread