rainbow1016 / payment-system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bank-system-rust

Table of Contents

Project Description

This project is an extension of Project 4: Prosumer/Consumer with different implementations and additional functionality. The goal of this project is to implement a simple banking application with Rust. Particularly, there is multiple accounts in the bank and each account has a balance where we can deposit, withdraw, or transfer money between accounts.

Design Decisions and Functionality

  • The project is implemented with Rust which has several advantages over C++. For example, Rust provides the memory safety through ownership and borrowing rule, eliminating many common programmings errorsm such as null pointer dereferences. Rust also has a lightweight concurrency model (referred as "fearless concurrency")that makes it easy to write concurrent programs without introducing data races or deadlocks, providng a safe and write .
  • The program will initialize a bank with 10 accounts. Then, it loads a text file containing the information of the ledger and creates "num_workers" (input from terminal) threads to process the transactions in the ledger list concurrently. Finally, the program will print the balance of all the accounts in the bank.

Learning Objectives

  1. Create multiple concurrent tasks using Rust's built-in threading capabilities.
  2. Apply Rust's ownership and borrowing system to minimize the scope and duration of critical sections, reducing the likelihood of data races.
  3. Employ Rust's synchronization primitives, such as Mutex and RwLock, to prevent deadlocks and ensure thread-safe execution.

Installation

  1. Make sure you have Rust and Cargo installed. If not, follow the official Rust installation guide: Rust Installation Guide.

  2. Clone the repository:

    git clone https://github.com/ThomasN12/bank-system-rust
  3. Navigate the project directory:

    cd bank-system
  4. Build the project using Cargo:

    cargo build
  5. Run the project with the following command:

    cargo run -- <num_workers> <ledger_filename>
    

Video Presentation

  1. Link to video
  2. Link to video-2 (In case the first one not working)

Slides

Link to slide

License

MIT License

About


Languages

Language:Rust 100.0%