Giter Site home page Giter Site logo

cs3013-project-3's Introduction

Project 3: threads and Syncronization
Library: pthread
    - Mutexes:
        pthread_mutex_lock & pthread_mutex_unlocked
    - Semaphores (condition)
        sem_wait, sem_post, sem_init
Goal: Create threads for each of our actors and debug synchronously.
    - Each thread uses randomness for scheduling (for testing use same seed)
Command Line Args:
    1. Number of costuming teams (2 min, 4 max)
    2. Number of pirates (10-50)
    3. Number of ninjas (10-50)
    4. Average time pirates spend in costume shop
    5. Average time ninjas spend in costume shop
    6. Average time pirates spend before revisiting costume shop
    7. Average time ninjas spend before revisiting costume shop
Problem:
    Any any given day, 10-50 pirates or ninjas enter our store
    Each staff can take care of appropriate amount of pirates or ninjas but never both
    Pirates and ninjas should identify themselves and which team it is using when entering or leaving
    Arrivals will be at random, and the amount of time that any individual takes to be outfited is random
    At end of custome session, there is a 25% chance they will come back
    Department keeps stats for billing, 1 gold, if wait is over 30 mins prior to entering, it is free
    Each Pirate and ninja is represented as a unique thread
    Each execution represents the operation of costume shop over a single day
    Code that creates the requisite number of ninjas and pirate threads and use either semaphores or locks to synchronize costume department
    Costume prep using sleep() with val from random distribution
Costume Department Usage Stats for Billing
    Bill for each Pirates and Ninjas
        -Number of visits
        -Amount of time of each visit
        -Wait times
        -Total gold owed
    Expenses & Profits
        -Each time costs 5 gold per day
        -Amount of time each team was busy
        -Amount of time each team was free
        -average queue length
        -Gross revenue (amount of gold)
        -Gold-per-visit
        -Profit

cs3013-project-3's People

Contributors

romanwicky avatar andraws avatar

Watchers

 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.