Code Monkey home page Code Monkey logo

kathleenwest / moneypotinstancingdemo Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 4.28 MB

This project presents a simple, but fun “Money Pot” Service and Client Application demonstration. The “Money Pot” is a self-hosted (service host) WCF application with a GUI user interface to quickly demo and test the service with a client (both simple Windows Form Applications). In addition, a short discussion of concurrency to protect resources against multiple threads is shown along with charts, pictures, and test data to show that with multiple threads (clients) wanting the “money pot” resource, can diminish what resources an individual client thread can receive if they compete against one another.

Home Page: https://portfolio.katiegirl.net/2019/10/14/the-money-pot-problem-a-demo-of-concurrency-in-singleton-and-percall-service-behaviors-in-a-wcf-service-application-client-tester-windows-form-application/

C# 100.00%
concurrency concurrent-programming concurrent-data-structure concurrency-patterns threadpool thread-safe threads threading thread-safety wcf

moneypotinstancingdemo's Introduction

MoneyPotInstancingDemo

The Money Pot Problem – A Demo of Concurrency in Singleton and PerCall Service Behaviors in a WCF Service Application & Client "Tester" Windows Form Application

Project URL: https://portfolio.katiegirl.net/2019/10/14/the-money-pot-problem-a-demo-of-concurrency-in-singleton-and-percall-service-behaviors-in-a-wcf-service-application-client-tester-windows-form-application/


Problem Formulation

Pretend there is a fictional money pot existing unguarded on a computer server. The leprechauns have left their pot of gold unguarded and anyone can take $ money from the pot. But there is a catch: the clever elves have limited the amount of cash that can be taken per transaction request and guarded the resources to prevent multiple money grabs at the same time (resource thread locking). In a race to get all the money available from the money pot, several computer fairies are hacking into the money pot and competing against each other to get the most money. Each fairy starts their computer “client” to connect to the leprechauns’ money pot server to drain as much as they can. To their disappointment, the computer fairies find that the more client connections (competition from other hackers) and requests they make to the money pot, the less $ money they receive compared to what they would receive if only one fairy hacker was hacking the money pot.


About

This project presents a simple, but fun “Money Pot” Service and Client Application demonstration. The “Money Pot” is a self-hosted (service host) WCF application with a GUI user interface to quickly demo and test the service with a client (both simple Windows Form Applications).

The service interface is defined not in the service application but in a Shared Library. This library defines the interface contracts for the $ money withdrawals and is referenced by both the client and service host projects.

A client “tester” windows form application tests the service and provides output to the user in a simple GUI.
In addition, a short discussion of concurrency to protect resources against multiple threads is shown along with charts, pictures, and test data to show that with multiple threads (clients) wanting the “money pot” resource, can diminish what resources an individual client thread can receive if they compete against one another.


Architecture

The demo project consists of these component topics:

• WCF Service (Self-Hosted) Application Project “MoneyServerHost”

o MoneyPotService (Code that Implements the Service Interface) o App.config (Configuration for Service Host) o Reference to the Shared Class Library o Main GUI (Windows Form Application) o Form Code – Processes GUI User Interface

• Shared Class Library Project “SharedLib”

o IMoneyPotService (Interface for Service)

• Client “Tester to Service” Windows Form Application Project “Client”

o Reference to the Shared Class Library o Main Form GUI User Interface o Form Code – Processes GUI User Interface

moneypotinstancingdemo's People

Contributors

kathleenwest avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.