PROGVIS(1)
π¦ PROGVIS(1) β bestie edition π¦
okay so like, this is the manual page for progvis, and it lives in the General Commands Manual section of the man pages (section 1, iykyk). pull up a chair, grab a boba, and let's get into it π
β¨ NAME β¨
progvis β a visualization tool for concurrent C/C++ programs π
β¨ SYNOPSIS β¨
progvis
β¨ DESCRIPTION β¨
Progvis is a program visualization tool, and it's aimed specifically at concurrent C/C++ programs π₯ It lets you load up arbitrary programs and then step through them, one step at a time, like you're walking through the code with a little flashlight π§
The tool also tells you about a whole bunch of concurrency issues β race conditions being the main character here π β so you actually see when your threads are doing something unhinged.
ngl though, only a subset of C/C++ is supported. For C, the most notable thing that's not supported is void pointers (this is on purpose, for type safety, bestie, it's for your own good). For C++, only fundamental language constructs are implemented β like, no templates, sorry π«Ά
Also, a whole lot of the standard libraries for both C and C++ are not implemented either. it's giving "minimalist" β¨
β¨ SYNCHRONIZATION β¨
The system gives you C-style synchronization primitives, exactly as implemented in Pintos β see: http://www.scs.stanford.edu/07au-cs140/pintos/pintos_6.html#SEC97
In summary, here's the whole squad:
struct semaphoreβ an implementation of a semaphore πsema_init(struct semaphore *sema, int value)β initialize a semaphore object to a particular (positive) value.sema_up(struct semaphore *sema)β increase the counter in the semaphore. also known as signal.sema_down(struct semaphore *sema)β decrease the counter in the semaphore, and it waits if it would become less than zero. also known as wait.struct lockβ an implementation of a lock πlock_init(struct lock *lock)β initialize a lock.lock_acquire(struct lock *lock)β acquire a lock. might wait π΄lock_release(struct lock *lock)β release a lock. > has to be done by the same thread that calledlock_acquire. no take-backs from a different thread, bestie.struct conditionβ implementation of a condition variable πΈcond_init(struct condition *cond)β initialize a condition variable.cond_wait(struct condition *cond, struct lock *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 beforecond_waitreturns β¨cond_signal(struct condition *cond, struct lock *lock)β wake one thread that is currently waiting insidecond_wait. assumes that the lock is held.cond_broadcast(struct condition *cond, struct lock *lock)β wake all threads that are currently waiting insidecond_wait.
β¨ ATOMIC OPERATIONS β¨
A number of atomic operations are also supported π₯ Most of these are generic, meaning they're overloaded to work for more than one type. So real quick, the notation, because this matters:
Pmeans any pointer typeImeans any integer type (i.e. signed and unsigned integers, as well as booleans)P/Imeans any pointer or integer type
got it? slay. here we go π
I test_and_set(I *v)β readvand return its value, and also setvto1.I atomic_add(I *v, I add)β addsaddto the value pointed to byv. returns the old value.I atomic_sub(I *v, I sub)β subtractssubfrom the value pointed to byv. returns the old value.P/I atomic_read(P/I *v)β read fromvand return the value.void atomic_write(P/I *to, P/I v)β write toto.P/I atomic_swap(P/I *v, P/I replace)β read the value pointed to byv, and replace it with the valuereplace. returns the old value.P/I compare_and_swap(P/I *v, P/I compare, P/I swap)β read the value fromv, if it was equal tocompare, replace it withswap. returns the old value.
β¨ SEE ALSO β¨
storm(1)β the language in which Progvis is implemented π
okay that's the whole page, bestie!! this version is from October 15 2023, and it's the PROGVIS(1) page, so you know exactly where to find it again π go forth and visualize those concurrent programs, you absolute icon πβ¨
π¦ where this page comes from
- debian trixie: progvis 0.6.28-3 Β· BSD-2-Clause
- ubuntu noble: progvis 0.6.20-1build3 Β· BSD-2-Clause
- ubuntu questing: progvis 0.6.28-3build1
- ubuntu resolute: progvis 0.7.5-3 Β· BSD-2-Clause
- ubuntu stonking: progvis 0.8.1+dfsg-1build1 Β· BSD-2-Clause
- Copyright 2021 Filip StrΓΆmbΓ€ck <filip@fprg.se>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms