#!/bin/bash
#
# run busy_wait COUNT times and show
# *only* the base address of the stack
#
COUNT=${1:-25}

#
# the loop
#
for i in `seq 1 1 $COUNT`	# loop $COUNT times
do 
	# run busy_wait and get its PID
    ./busy_wait &
    PID=$!
    
    # now get the mapping for the stack
    cat /proc/$PID/maps | grep stack
    
    # clean up and do it again
    kill -9 $PID
done
