Skip to content

Commit

Permalink
countem2.sh: fix calc of # of kernel-mode stacks
Browse files Browse the repository at this point in the history
in memory

Signed-off-by: Kaiwan N Billimoria <[email protected]>
  • Loading branch information
kaiwan committed Dec 27, 2024
1 parent 40e778d commit 5963e89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ with<br>

- page 264:
- Added the ch6/countem2.sh Bash script to the repo; it complements the ch6/countem.sh script, adding on a few details
- An error in the ch6/countem2.sh script has now (27dec2024) been fixed (fix calc of # of kernel-mode stacks in memory; feeing sheepish again!)

- Ch 13
- *Sincere apologies!* I've made several (small-ish) mistakes here! (please read on...)
Expand Down
4 changes: 2 additions & 2 deletions ch6/countem2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ total_kthrds=$(cat ${TMPT}|awk '{print $10}'|grep "^\["|wc -l)
printf "3. Total # of kernel threads alive = %9d\n" ${total_kthrds}
printf " (each kthread will have a kernel-mode stack)\n"
total_uthrds=$((${total_thrds}-${total_kthrds}))
printf "4. Thus, total # of user mode threads = (2) - (3) = %9d\n" ${total_uthrds}
printf "4. Thus, total # of user mode threads = (2) - (3) = %9d\n" ${total_uthrds}
printf " (each uthread will have both a user and kernel-mode stack)\n"
printf "5. Thus, total # of kernel-mode stacks = (3) + (4)*2 = %9d\n" $((${total_kthrds}+(${total_uthrds}*2)))
printf "5. Thus, total # of kernel-mode stacks = (3) + (4) = %9d\n" $((${total_kthrds}+${total_uthrds}))

rm -f ${TMPP} ${TMPT}
exit 0

0 comments on commit 5963e89

Please sign in to comment.