More optimizations of the ps command #23
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
pscommand has been unbearably slow on floppy based systems because of excessive disk reads.The problem was partly fixed in the previous
psPR by replacing thegetpwentopen and read of the/etc/passwdfile once per line of output with a localgetpwent-version that kept/etc/passwdopen. Good but still slow.The other contributor to the bad
psperformance was the ttyname lookup, which opened and scanned the entire/devdirectory for every line out output. This version keeps the/devdirectory open and also optimizes the search for tty devices in several ways.psperformance on floppy based systems with limited memory (such as L1 buffers only) is now quite good.Finally, while
pshas always done some sanity checking of the kernel data read from memory, it has just exited silently when the data didn't make sense. This version adds more sanity checking and prints a message recommendingpsbe recompiled if the expected kernel signature isn't found. Courtesy @ghaerr from the ELKS project.