Giter Club home page Giter Club logo

pa6's Introduction

Readme
Project 6
Erik Kamp
Eugene Foley
Group 1


The multithreaded book orders program starts by taking in the file arguments which are the book orders file,
users file and category file. If the user does not enter in all elements an error message appears. If the user en
ters in -h then the program tells you what it needs to run. 

After opening the files and assigning them a pointer the program then goes and reads the users into the database using the openDB function. Then the program continues and starts to look at the orders file.

The book orders file spawns a new thread for each order. The new thread takes in the user and the order read in f
rom getline. When the threads run only one thread at a time has the lock on the user. Therefore multiple threads 
can be running at a time because of the many users in the database and orders file. Once the thread is done with 
the user the user becomes unlocked and the thread waiting for the user wakes up and relocks the user. Additionall
y a semaphore is used to make sure all threads are done writting to the file. Once the semaphores value reaches  
then the producer thread knows that consumer threads are done writting to the database. Once done the data stored
in memory is then written and then freed.

In all our program is very efficent in time and memory. It is efficent in run time due to the multiple threads be
ing run at the same time over different users, as oppossed to running one thread that goes through all the users.
Additionally it is easy to search for users because they are stored in an array therefore a linear search time
is attained. Additionally it is effiecent with memory due to the fact that the array of users is a pointer to a
linked list and is not copied over, which would waste space if not allocated and freed properly.

pa6's People

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.