From 5963e897ac6fc0cda02f6258cec093fca64d1a6a Mon Sep 17 00:00:00 2001 From: Kaiwan N Billimoria Date: Fri, 27 Dec 2024 16:10:57 +0530 Subject: [PATCH] countem2.sh: fix calc of # of kernel-mode stacks in memory Signed-off-by: Kaiwan N Billimoria --- README.md | 1 + ch6/countem2.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0819380..5c1fa66 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ with
- 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...) diff --git a/ch6/countem2.sh b/ch6/countem2.sh index c9427ba..874758f 100755 --- a/ch6/countem2.sh +++ b/ch6/countem2.sh @@ -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