Skip to content

Latest commit

 

History

History

Multithreading_Lab_5

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Java - Multithreading (Lab 5)

1. Divisors

Find the integer that has the largest number of divisors and print the number of divisors for numbers in the range 1 to 100000. Use threads to solve this problem.

2. Sieve of Eratosthenes

Sieve of Eratosthenes algorithm finds all prime numbers less than ‘n’ when ‘n’ is very large. The algorithm is given below. Algorithm: Create a list of natural numbers

Set k=2, the first unmarked number on the list Repeatedly do for k < sqrt (n)
    a. Mark all multiples of k in the natural numbers list.
    b. Find the next prime number i.e., the unmarked one and set it as k.

The unmarked numbers are primes.

3. Producer Consumer problem

Recall the producer consumer problem you studied in operating systems. Solve it using the multi threading concepts.