PROGVIS(1)

πŸ“¦
version 0.8.1 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ¦‹ 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 called lock_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 before cond_wait returns ✨
  • cond_signal(struct condition *cond, struct lock *lock) β€” wake one thread that is currently waiting inside cond_wait. assumes that the lock is held.
  • cond_broadcast(struct condition *cond, struct lock *lock) β€” wake all threads that are currently waiting inside cond_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:

  • P means any pointer type
  • I means any integer type (i.e. signed and unsigned integers, as well as booleans)
  • P/I means any pointer or integer type

got it? slay. here we go πŸŽ€

  • I test_and_set(I *v) β€” read v and return its value, and also set v to 1.
  • I atomic_add(I *v, I add) β€” adds add to the value pointed to by v. returns the old value.
  • I atomic_sub(I *v, I sub) β€” subtracts sub from the value pointed to by v. returns the old value.
  • P/I atomic_read(P/I *v) β€” read from v and return the value.
  • void atomic_write(P/I *to, P/I v) β€” write to to.
  • P/I atomic_swap(P/I *v, P/I replace) β€” read the value pointed to by v, and replace it with the value replace. returns the old value.
  • P/I compare_and_swap(P/I *v, P/I compare, P/I swap) β€” read the value from v, if it was equal to compare, replace it with swap. 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