Very nice write-up, and a great way to dive deep into an interesting system! But if you plan on maintaining a project like this long term I would recommend using one of the many existing libraries like <a href="https://github.com/prometheus/procfs" rel="nofollow">https://github.com/prometheus/procfs</a> or <a href="http://pythonhosted.org/psutil/" rel="nofollow">http://pythonhosted.org/psutil/</a><p>There can be a lot of edge cases, and inevitability things will change in the future. Centralising the work of parsing /proc files goes a long way and helps keep things sane for maintenance.