From c4e6c9704cebd68b28e4e13f06852a1f0882f24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20L=C3=A4ufer?= Date: Fri, 1 Sep 2023 18:17:08 -0500 Subject: [PATCH] added concrete example to readme MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Konstantin Läufer --- README.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 043c1e7..7ae4a46 100644 --- a/README.md +++ b/README.md @@ -29,31 +29,78 @@ This is a Scala-based solution to the [process tree homework assignment](http://osdi.etl.luc.edu/homework/home-lab-assignment-1) from the course -[COMP 374/410: Introduction to Operating Systems](http://osdi.etl.luc.edu). +[COMP 374/410: Introduction to Operating +Systems](http://osdi.etl.luc.edu). + +In short, this program converts a flat list of current processes, as printed by the `ps` command + +``` +> ps -ef + UID PID PPID C STIME TTY TIME CMD + 0 1 0 0 24Aug23 ?? 72:25.36 /sbin/launchd + 0 102 1 0 24Aug23 ?? 26:34.38 /usr/libexec/logd + 0 103 1 0 24Aug23 ?? 0:01.08 /usr/libexec/smd +... + 502 60706 60704 0 10:53PM ?? 0:02.27 /Applications/WhatsApp.app/... +... + 502 65138 735 0 10:48AM ?? 0:23.83 /Applications/Microsoft Edge.app/... +... +``` + +to a hierarchical process tree, as printed by the `pstree` command (you'd usually have to install this through your package manager). + +``` +> pstree +-+= 00001 root /sbin/launchd + |--= 00102 root /usr/libexec/logd + |--= 00103 root /usr/libexec/smd + . + . + . + |-+= 00735 laufer /Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge + | |--- 65138 laufer /Applications/Microsoft Edge.app/Contents/Frameworks/Microsoft Edge + . + . + . + |-+= 60704 laufer /Applications/WhatsApp.app/... + | |--- 60706 laufer /Applications/WhatsApp.app/... + . + . + . +``` + # Usage To run the tests: - $ sbt test +``` +$ sbt test +``` To run the main methods: - $ ps -ef | sbt "runMain edu.luc.etl.osdi.processtree.scala.mutable.Main" - $ ps -ef | sbt "runMain edu.luc.etl.osdi.processtree.scala.groupby.Main" - $ ps -ef | sbt "runMain edu.luc.etl.osdi.processtree.scala.fold.Main" +``` +$ ps -ef | sbt "runMain edu.luc.etl.osdi.processtree.scala.mutable.Main" +$ ps -ef | sbt "runMain edu.luc.etl.osdi.processtree.scala.groupby.Main" +$ ps -ef | sbt "runMain edu.luc.etl.osdi.processtree.scala.fold.Main" +``` To generate larger data sets for testing: - $ sbt "test:runMain edu.luc.etl.osdi.processtree.scala.fakeps.Main 100000" > data.txt +``` +$ sbt "test:runMain edu.luc.etl.osdi.processtree.scala.fakeps.Main 100000" > data.txt +``` To run the benchmarks: - $ sbt "test:runMain edu.luc.etl.osdi.processtree.scala.fakeps.Benchmark" - $ sbt "test:runMain edu.luc.etl.osdi.processtree.scala.mutable.Benchmark" - $ sbt "test:runMain edu.luc.etl.osdi.processtree.scala.groupby.Benchmark" - $ sbt "test:runMain edu.luc.etl.osdi.processtree.scala.fold.Benchmark" +``` +$ sbt "test:runMain edu.luc.etl.osdi.processtree.scala.fakeps.Benchmark" +$ sbt "test:runMain edu.luc.etl.osdi.processtree.scala.mutable.Benchmark" +$ sbt "test:runMain edu.luc.etl.osdi.processtree.scala.groupby.Benchmark" +$ sbt "test:runMain edu.luc.etl.osdi.processtree.scala.fold.Benchmark" +``` On Windows, if you installed [Git](http://git-scm.com/) with the recommended third option, *Use Git and optional Unix tools from the Windows Command Prompt*, -then you will have a `ps` command available. \ No newline at end of file +then you will have a `ps` command available.