Giter Site home page Giter Site logo

oop.assignment2's Introduction

OOP.Assignment2

PART A

Brief

we created numbers of files and compute number lines for each file , by using 3 methods:

  1. normal method without using thread
  2. used threads
  3. used ThreadPool

The following tables show 3 scenarios in each scenario are measured 3 methods on fixed amounts of files In ascending order of lines per file

Scenario 1: Up to 10 lines in a single file

Ex2_1.createTextFiles(10000, 1, 10);

10000 Files 1000 Files 100 Files 10 Files
getNumOfLines() 9 sec 478 ms 167 ms 152 ms 86 ms
getNumOfLinesThreads() 1 sec 733 ms 228 ms 61 ms 47 ms
getNumOfLinesThreadPool() 2 sec 90 ms 228 ms 55 ms 47 ms
total lines 45309 4738 476 57

Scenario 2: Up to 100 lines in a single file

Ex2_1.createTextFiles(10000, 1, 100);

10000 Files 1000 Files 100 Files 10 Files
getNumOfLines() 13 sec 709 ms 1 sec 601 ms 448 ms 95 ms
getNumOfLinesThreads() 1 sec 632 ms 255 ms 78 ms 48 ms
getNumOfLinesThreadPool() 2 sec 8 ms 210 ms 65 ms 48 ms
total lines 499039 50698 4956 457

Scenario 3: Up to 1000 lines in a single file

Ex2_1.createTextFiles(10000, 1, 1000);

10000 Files 1000 Files 100 Files 10 Files
getNumOfLines() 55 sec 304 ms 6 sec 800 ms 649 ms 110 ms
getNumOfLinesThreads() 1 sec 835 ms 289 ms 100 ms 42 ms
getNumOfLinesThreadPool() 2 sec 251 ms 286 ms 103 ms 54 ms
total lines 5005739 508498 51056 6657

Conclusions

It can be seen that the more files there are, and the more lines there are in each file,

the more the functions that use threads are significantly faster than the normal function

that does not use threads. Another thing, you can notice that the third function that

uses threadpool, takes a little more time than the second function.

We assume that this is the case because both use more or less the same number of threads,

but we pay the overhead of creating the threadpool and operating it.

UML

PART B

OBJECTIVE

Here we created two new types that extend the functionality of Java's Concurrency Framework

  1. A generic task with a Type that returns a result and may throw an exception. Each task has a priority used for scheduling inferred from the integer value of the tasks Type.
  2. A custom thread pool class that defines a method for submitting a generic task as described in the section 1 to a priority queue, and a method for submitting a generic task created by a Callable and a Type, passed as arguments.

UML

Languages and Tools

oop.assignment2's People

Contributors

sari-saif avatar simchateich avatar

Watchers

 avatar

Forkers

simchateich

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.