grxer@grxer ~/D/s/O/o/threads-intro> cat looping-race-nolock.s # assumes %bx has loop count in it
.main .top # critical section mov 2000, %ax # get 'value' at address 2000 add $1, %ax # increment it mov %ax, 2000 # store it back
# see if we're still looping sub $1, %bx test $0, %bx jgt .top
halt grxer@grxer ~/D/s/O/o/threads-intro> python ./x86.py -p looping-race-nolock.s -t 2 -M 2000 -i 4 -r -s 0 -c ARG seed 0 ARG numthreads 2 ARG program looping-race-nolock.s ARG interrupt frequency 4 ARG interrupt randomness True ARG argv ARG load address 1000 ARG memsize 128 ARG memtrace 2000 ARG regtrace ARG cctrace False ARG printstats False ARG verbose False
2000 Thread 0 Thread 1 0 0 1000 mov 2000, %ax 0 1001 add $1, %ax 1 1002 mov %ax, 2000 1 1003 sub $1, %bx 1 ------ Interrupt ------ ------ Interrupt ------ 1 1000 mov 2000, %ax 1 1001 add $1, %ax 2 1002 mov %ax, 2000 2 1003 sub $1, %bx 2 ------ Interrupt ------ ------ Interrupt ------ 2 1004 test $0, %bx 2 1005 jgt .top 2 ------ Interrupt ------ ------ Interrupt ------ 2 1004 test $0, %bx 2 1005 jgt .top 2 ------ Interrupt ------ ------ Interrupt ------ 2 1006 halt 2 ----- Halt;Switch ----- ----- Halt;Switch ----- 2 1006 halt grxer@grxer ~/D/s/O/o/threads-intro> python ./x86.py -p looping-race-nolock.s -t 2 -M 2000 -i 4 -r -s 1 -c ARG seed 1 ARG numthreads 2 ARG program looping-race-nolock.s ARG interrupt frequency 4 ARG interrupt randomness True ARG argv ARG load address 1000 ARG memsize 128 ARG memtrace 2000 ARG regtrace ARG cctrace False ARG printstats False ARG verbose False
2000 Thread 0 Thread 1 0 0 1000 mov 2000, %ax 0 ------ Interrupt ------ ------ Interrupt ------ 0 1000 mov 2000, %ax 0 1001 add $1, %ax 1 1002 mov %ax, 2000 1 1003 sub $1, %bx 1 ------ Interrupt ------ ------ Interrupt ------ 1 1001 add $1, %ax 1 1002 mov %ax, 2000 1 1003 sub $1, %bx 1 1004 test $0, %bx 1 ------ Interrupt ------ ------ Interrupt ------ 1 1004 test $0, %bx 1 1005 jgt .top 1 ------ Interrupt ------ ------ Interrupt ------ 1 1005 jgt .top 1 1006 halt 1 ----- Halt;Switch ----- ----- Halt;Switch ----- 1 ------ Interrupt ------ ------ Interrupt ------ 1 1006 halt grxer@grxer ~/D/s/O/o/threads-intro> python ./x86.py -p looping-race-nolock.s -t 2 -M 2000 -i 4 -r -s 2 -c ARG seed 2 ARG numthreads 2 ARG program looping-race-nolock.s ARG interrupt frequency 4 ARG interrupt randomness True ARG argv ARG load address 1000 ARG memsize 128 ARG memtrace 2000 ARG regtrace ARG cctrace False ARG printstats False ARG verbose False
2000 Thread 0 Thread 1 0 0 1000 mov 2000, %ax 0 1001 add $1, %ax 1 1002 mov %ax, 2000 1 1003 sub $1, %bx 1 ------ Interrupt ------ ------ Interrupt ------ 1 1000 mov 2000, %ax 1 1001 add $1, %ax 2 1002 mov %ax, 2000 2 1003 sub $1, %bx 2 ------ Interrupt ------ ------ Interrupt ------ 2 1004 test $0, %bx 2 ------ Interrupt ------ ------ Interrupt ------ 2 1004 test $0, %bx 2 ------ Interrupt ------ ------ Interrupt ------ 2 1005 jgt .top 2 1006 halt 2 ----- Halt;Switch ----- ----- Halt;Switch ----- 2 1005 jgt .top 2 1006 halt
|