finds.dev← search

// the find

p-cherukuri/mt-mp-bank

C · updated Jan 2016

A Unix online banking system with a multithreaded client and multiprocessing server. When a session is opened, the client can check account balance, make deposits and withdrawals. Built with C.

A university assignment (Rutgers, circa 2016) implementing a toy banking system in C: forking TCP server with shared memory and semaphores, multithreaded client. It demonstrates IPC primitives — shared memory, POSIX semaphores, pthreads, signals — in a single coherent example. Not production software; a learning artifact.

The semaphore usage is reasonably correct — per-account semaphores for session locks plus a global bank semaphore for account creation is the right decomposition. Signal handler for SIGCHLD reaps children properly, avoiding zombie accumulation. SIGINT cleanup path frees shared memory and notifies connected clients rather than just exiting. The busy-wait on sem_trywait at least includes a delay to avoid spinning the CPU flat out.

The author documented a known stdout interleaving bug and never fixed it — that's not a minor cosmetic issue, it means concurrent client output is corrupted by design. Hard limit of 20 accounts is baked into a struct array in shared memory with no overflow protection visible in the README. Account names are presumably fixed-length char arrays, so a long name is either silently truncated or a buffer overflow. No persistence — every server restart wipes all accounts, which makes this a demo, not a system.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →