progvis - visualization tool for concurrent C/C++ programs
Contents
Atomic Operations
A number of atomic operations are also supported. Most of these are generic, meaning that they are
overloaded to work for more than one type. Here, we use P to mean any pointer type, I to mean any integer
type (i.e. signed and unsigned integers, as well as booleans), and P/I to mean any pointer or integer
type.
Itest_and_set(I*v)
Read v and return its value, also setting v to 1.
Iatomic_add(I*v,Iadd)
Adds add to the value pointed to by v. Returns the old value.
Iatomic_sub(I*v,Isub)
Subtracts sub from the value pointed to by v. Returns the old value.
P/Iatomic_read(P/I*v)
Read from v and return the value.
voidatomic_write(P/I*to,P/Iv)
Write to to.
P/Iatomic_swap(P/I*v,P/Ireplace)
Read the value pointed to by v, and replace it with the value replace. Returns the old value.
P/Icompare_and_swap(P/I*v,P/Icompare,P/Iswap)
Read the value from v, if it was equal to compare, replace it with swap. Returns the old value.
Description
Progvis is a program visualization tool aimed at concurrent C/C++ programs. It allows loading arbitrary
programs and stepping through them. The tool also informs about a number of concurrency issues, such as
race conditions. Only a subset of C/C++ is supported. For C, most notably void pointers are not supported
(for type safety). For C++, only fundamental language constructs are implemented (e.g. no templates).
Much of the standard libraries both for C and C++ are not implemented either.
Name
progvis - visualization tool for concurrent C/C++ programs
See Also
storm(1) - the language in which Progvis is implemented. October 15 2023 PROGVIS(1)
Synchronization
The system provides C-style synchronization primitives as implemented in Pintos, see:
http://www.scs.stanford.edu/07au-cs140/pintos/pintos_6.html#SEC97 In summary, they are as follows:
structsemaphore
An implementation of a semaphore.
sema_init(structsemaphore*sema,intvalue)
Initialize a semaphore object to a particular (positive) value.
sema_up(structsemaphore*sema)
Increase the counter in the semaphore. Also known as signal.
sema_down(structsemaphore*sema)
Decrease the counter in the semaphore, waits if it would become less than zero. Also known as
wait.
structlock
An implementation of a lock.
lock_init(structlock*lock)
Initialize a lock.
lock_acquire(structlock*lock)
Acquire a lock. Might wait.
lock_release(structlock*lock)
Release a lock. Has to be done by the same thread that called lock_acquire.
structcondition
Implementation of a condition variable.
cond_init(structcondition*cond)
Initialize a condition variable.
cond_wait(structcondition*cond,structlock*lock)
Cause the current thread to wait until the condition is signalled. Assumes that the lock is held.
The lock will be released while the thread is waiting, but it will be re-acquired before cond_wait
returns.
cond_signal(structcondition*cond,structlock*lock)
Wake one thread that is currently waiting inside cond_wait. Assumes that the lock is held.
cond_broadcast(structcondition*cond,structlock*lock)
Wake all threads that are currently waiting inside cond_wait.
Synopsis
progvis
