Tracks
/
Tcl
Tcl
/
Exercises
/
Bank Account
Bank Account

Bank Account

Easy

Instructions

Simulate a bank account supporting opening/closing, withdrawals, and deposits of money. Watch out for concurrent transactions!

A bank account can be accessed in multiple ways. Clients can make deposits and withdrawals using the internet, mobile phones, etc. Shops can charge against the account.

Create an account that can be accessed from multiple threads/processes (terminology depends on your programming language).

It should be possible to close an account; operations against a closed account must fail.

This exercises introduces threads to test how robust your bank account is for concurrent operations. Some reading material for Tcl threads:

Installation

Some Tcl distributions do not include Tcl's Thread package by default: it may need to be install separately. Verify with

$ echo 'package require Thread' | tclsh

If that produces no output then the Thread package is already installed.

Execute apt install tcl-thread (or dnf install tcl-thread) as required.

Edit via GitHub The link opens in a new window or tab
Tcl Exercism

Ready to start Bank Account?

Sign up to Exercism to learn and master Tcl with 124 exercises, and real human mentoring, all for free.