Polytechnic University of Tirana Faculty of Information Technology Computer Engineering Department A MULTITHREADED SEARCH ENGINE AND TESTING OF MULTITHREADED.

Slides:



Advertisements
Similar presentations
Usage of the memoQ web service API by LSP – a case study
Advertisements

Multithreaded Programs in Java. Tasks and Threads A task is an abstraction of a series of steps – Might be done in a separate thread – Java libraries.
CHESS: A Systematic Testing Tool for Concurrent Software CSCI6900 George.
Intro to Threading CS221 – 4/20/09. What we’ll cover today Finish the DOTS program Introduction to threads and multi-threading.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 48 Hashing.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L20 (Chapter 24) Multithreading.
Presented By: Ayelet Birnbaum Yael Kazaz Supervisor: Viktor Kulikov 07/05/12.
Threads in Java1 Concurrency Synchronizing threads, thread pools, etc.
Threading in Java – a Tutorial QMUL IEEE SB. Why Threading When we need to run two tasks concurrently So multiple parts (>=2) of a program can run simultaneously.
Introduction to Databases and Database Languages
Object Oriented Databases by Adam Stevenson. Object Databases Became commercially popular in mid 1990’s Became commercially popular in mid 1990’s You.
CS252: Systems Programming Ninghui Li Final Exam Review.
1 Advanced Computer Programming Concurrency Multithreaded Programs Copyright © Texas Education Agency, 2013.
1 Testing Concurrent Programs Why Test?  Eliminate bugs?  Software Engineering vs Computer Science perspectives What properties are we testing for? 
CHP - 9 File Structures. INTRODUCTION In some of the previous chapters, we have discussed representations of and operations on data structures. These.
Chapter 3 – Agile Software Development 1Chapter 3 Agile software development.
9/13/20151 Threads ICS 240: Operating Systems –William Albritton Information and Computer Sciences Department at Leeward Community College –Original slides.
Zhonghua Qu and Ovidiu Daescu December 24, 2009 University of Texas at Dallas.
Advanced Operating Systems CIS 720 Lecture 1. Instructor Dr. Gurdip Singh – 234 Nichols Hall –
Austin Java Users Group developerWorks article – µActor Library BARRY FEIGENBAUM, PH. D. 02/26/13.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Silberschatz, Galvin and Gagne ©2011Operating System Concepts Essentials – 8 th Edition Chapter 4: Threads.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Winrunner Usage - Best Practices S.A.Christopher.
UDoCument: Electronic Scrapbook for the Information Era Soufiane Berouel, Undergraduate Student Supervised by Prof. Lily Liang Department of Computer Science.
Threads in Java. History  Process is a program in execution  Has stack/heap memory  Has a program counter  Multiuser operating systems since the sixties.
Threading and Concurrency Issues ● Creating Threads ● In Java ● Subclassing Thread ● Implementing Runnable ● Synchronization ● Immutable ● Synchronized.
The HDF Group Multi-threading in HDF5: Paths Forward Current implementation - Future directions May 30-31, 2012HDF5 Workshop at PSI 1.
Version control Using Git Version control, using Git1.
BLU-ICE and the Distributed Control System Constraints for Software Development Strategies Timothy M. McPhillips Stanford Synchrotron Radiation Laboratory.
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
Packed Object Synchronization Introduction Many Java applications and frameworks must deal directly with native data. Packed Objects provide an approach.
Practical OOP using Java Basis Faqueer Tanvir Ahmed, 08 Jan 2012.
Synchronizing threads, thread pools, etc.
Lecture 5: Threads process as a unit of scheduling and a unit of resource allocation processes vs. threads what to program with threads why use threads.
Department of Computer Science and Software Engineering
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Thread basics. A computer process Every time a program is executed a process is created It is managed via a data structure that keeps all things memory.
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
ConcJUnit: Unit Testing for Concurrent Programs COMP 600 Mathias Ricken Rice University August 24, 2009.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 4: Threads.
1 Why Threads are a Bad Idea (for most purposes) based on a presentation by John Ousterhout Sun Microsystems Laboratories Threads!
Soyeon Park, Shan Lu, Yuanyuan Zhou UIUC Reading Group by Theo.
Reachability Testing of Concurrent Programs1 Reachability Testing of Concurrent Programs Richard Carver, GMU Yu Lei, UTA.
GROUP PresentsPresents. WEB CRAWLER A visualization of links in the World Wide Web Software Engineering C Semester Two Massey University - Palmerston.
CS 440 Database Management Systems Stored procedures & OR mapping 1.
Concurrent Programming in Java Based on Notes by J. Johns (based on Java in a Nutshell, Learning Java) Also Java Tutorial, Concurrent Programming in Java.
Processes Chapter 3. Processes in Distributed Systems Processes and threads –Introduction to threads –Distinction between threads and processes Threads.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Hongbin Li 11/13/2014 A Debugger of Parallel Mutli- Agent Spatial Simulation.
Introduction to threads
Chapter 4: Multithreaded Programming
A brief intro to: Parallelism, Threads, and Concurrency
CHP - 9 File Structures.
Processes and Threads Processes and their scheduling
Chapter 5: Threads Overview Multithreading Models Threading Issues
Chapter 4: Multithreaded Programming
Concurring Concurrently
Chapter 2: System Structures
Modified by H. Schulzrinne 02/15/10 Chapter 4: Threads.
Lecture 1-Part 2: Operating-System Structures
Reachability testing for concurrent programs
Operating System Introduction.
Chapter 4: Threads & Concurrency
Chapter 4: Threads.
Presentation transcript:

Polytechnic University of Tirana Faculty of Information Technology Computer Engineering Department A MULTITHREADED SEARCH ENGINE AND TESTING OF MULTITHREADED CODE IN JAVA Blandi Alcani

Overview of the presentation 1.Specifications 2.Design 1.Multithreading in Java 2.Concurrent Data Structures in Java 3.Text Extracting Libraries 3.Implementation and screenshots 4.Testing of the Multithreaded environment in Java 2

1. Specifications Index text documents located in the hard drive or the local network. Should be able to index files of different types including Microsoft Word, PDF, plain text, rich text format etc. The index is to be held in a data structure with a high performance such as a hash table. The indexing of the files should be made in a multithreaded environment. 3

2.1 Multithreading in Java – an overview A thread in Java is an object that implements the Runnable interface. Runnable defines the method run() – where the code of the thread is written. A thread class can be created by extending the Thread class, which implements the Runnable interface and can invoke a thread by using Thread.start() 4

2.1 Management of threads in Java Starting a thread manually can be difficult. For each thread => Thread Object => Too much overhead. An Executor object can start many threads. An ExecutorService object can terminate many threads. Thread Pools offer recycling of thread objects, thus avoiding thread creation overhead. 5

2.2 Data structures in Java – Collections Framework “Container” of Objects. Easy data manipulation (search, insert, delete) Can be used with iterator objects. Two main divisions: Collections and Maps Key => Value Words in a document => Document name/location, line etc. Concurrent Maps – Multithreading support 6

2.2 ConcurrentHashMap It is thread safe without synchronizing the whole map. Reads can happen very fast while write is done with a lock. The locking is at a much finer granularity at a hashmap bucket level. ConcurrentHashMap uses multitude of locks. 7

2.2 ConcurrentHashMap 8

2.3 Text Extracting Libraries Apache Open Source Libraries Implemented in 100% Java, good performance. PDFBox – Apache Library for PDF documents manipulation and extraction of text. Apache POI - Apache Library for Microsoft documents manipulation and extraction of text. 9

3. Implementation and Screenshots User friendly, simple menu based GUI Separation of user interface and functionality. Searching with binary operands Index class is serializable, object => file and vice-versa. 3 classes ◦Index entry class ◦Index class ◦User interface class 10

3. Implementation and Screenshots 11

4. Testing in the multithreaded environment Testing multithreaded code can be difficult and challenging: ◦Concurrency introduces non-determinism – Multiple executions of the same test may have different interleaving (different execution order for threads) ◦Bugs are very hard to reproduce and debug 3 main approaches to test multithreaded code: ◦JUnit, thread management left to the application. ◦JUnit, thread management done from JUnit. ◦Third party libraries for JUnit, specialized in concurrent code testing. 12

4. Testing in the multithreaded environment JUnit, thread management left to the application. Pros: ◦No modification of the original software needed. Cons: ◦Less control of thread management. ◦Least effective. No significant multithread related bugs are caught. 13

4. Testing in the multithreaded environment JUnit, thread management done from JUnit. Pros: ◦More control of thread management – more scenarios covered, more bugs detected. Cons: ◦Requires modification of original application before and after the tests. 14

4. Testing in the multithreaded environment Third party libraries for Junit, specialized in concurrent code testing. For example: ConTest by IBM, jMock, GroboUtils etc. Pros: ◦Cause synchronization problems to more likely surface in testing ◦Support the traditional test coverage models (e.g. branch coverage and method coverage) as well as advanced synchronization coverage models ◦Support partial replay, increasing likelihood that a program scenario which gave rise to a specific synchronization problem will recur ◦Produces a lot of useful debugging information ◦More bugs detected ◦Best option Cons: ◦Learn the API ◦Usually requires licence 15

Thank you! References D. Liang, Introduction to Java Programming (2010) B. Goetz, Java Concurrency in Practice (2006) Apache POI project, poi.apache.org ConTest Project, 16