Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can anyone help me with this ? It needs to be done in Java Description To handle a large amount of data it has been

Can anyone help me with this ? It needs to be done in Java

image text in transcribed

Description To handle a large amount of data it has been decided to filter the data into separate files. The data is larger than the local storage capacity so all the data cannot be handled at once. In this assignment we are only interested in a concurrent implementation of this filtering. So a number of simplifications have been made to the above scenario. . The data is assumed to be integers. The size of the local storage capacity is m (below m is chosen to be 4). The size of the data is n (below n is chosen to be 100m 400). Any storage needed to handle concurrency cornectly is assumed to be negligible compared to n and m, so this is d The filtering is into k files (below k is chosen to be 2). arded. [Clearly, in a real application m and n would be several magnitudes larger] lask Develop a multithreaded program with three concurrent threads, A, B and C. Thread A generates n random integer numbers and writes them into a shared memory with a capac- ity of m integers. Due to the limited capacity of the shared memory, thread A cannot write all numbers at once. Threads B and C read the integer numbers from the shared memory Thread B writes the even numbers to th file even-numbers and thread C writes the odd numbers to the file odd-numbers. Every number generated by thread A should be writ ten in one of the two files. No number should be written twice. Choose any method, or combination of methods, for synchronization. To achieve full marks: Encapsulate the synchronized methods and the shared memory into one structure. Avoid busy waiting- Avoid static variables. Extension task Write code that could easily be modified to cater for different values of m, n, and k above. For k -3you may consider the three classes of odd numbers, even numbers, and multi- ples of 3. Note that these are non-disjoint: numbers belonging to more than one class can be filtered into any of these but should still only appear in one of the output files. Partial credit for this can be achieved by describing what is needed during the viva

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions