GithubHelp home page GithubHelp logo

sta250hw2's Introduction

STA250HW2

In this homework we evaluate the mean, standard deviation and median of flight arrival delay from several *.csv files, by taking parallel approaches.

Our first implementation is based on the R parallel package using the frequency table (histogram) method. Each call of function funFreqTable() is in charge of build a frequency table for each file by reading the file from standard input block-by-block. In our bash command, we use sed to handle the comma in the quoted field by simply removing it. When mapply() returns a list of frequency table, we combine them to get a grand frequency table.

Our second implementation is based on a task pool model implemented with pthread. Specifically, we build a structure entity called data, whose members include all the filenames of all .csv files, flag value indicating whether each file has been processed by a worker thread or not, and a frequency table for the files processed so far. We start several worker threads, each of which fetches an unprocessed file from data, compute its frequency table using fast sample method with sampling probability of 0.0002, and combine the result with the grand frequency table in the data entity. Upon accessing the file name and updating the grand frequency table, we need two mutex respectively to avoid conflict between different threads. The frequency table is implemented with the hist class we defined in Assignment 1.

sta250hw2's People

Contributors

huragok 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.