Find Jobs
Hire Freelancers

java micro app

$10-30 USD

Închis
Data postării: peste 3 ani în urmă

$10-30 USD

Plata la predare
1: Thread creation (30%) a. Using Java multithreading library, write a Java program that calculates the sum of the numbers from 1 to 100,000,000. Split the numbers between four threads equally where each thread calculates the sum of one fourth of the numbers. For example, the 1st thread will calculate the sum of the numbers from 1 to 25,000,000 whereas the 2nd thread will calculate the sum of the numbers from 25,000,001 to 50,000,000 and so forth. The main thread will have to print out the sum after gathering the results. Note that you have the choice to create threads by either implementing Runnable interface or extending Thread class. b. Now, write a sequential version of the program described above using a single main thread (i.e., without multithreading). Make sure to record and print out the time spent during the execution of both sequential and multithreaded versions (hint: you may consider using [login to view URL]() to record execution time). Part 2: Synchronization (40%) Assume that we have a file named “[login to view URL]” which can be shared among several threads. We want to write a program that controls the access to that file in a way that only one thread at a time is allowed to access it (i.e., for writing/appending purposes). Using Java multithreading, write a program that creates three threads and assigns a number to each thread. Then, each thread will start running by executing a code for opening the file “[login to view URL]” and writing the following lines: Thread x started writing Thread x is currently writing Thread x finished writing – Student Name Your program should allow only one thread -at any given time-to access the file and write in it. It also should keep away any thread from overwriting the lines written by any other threads (hint: use synchronized methods/blocks). Finally, when the execution of your program is completed, the output stored in “[login to view URL]” should look like the following – put your name in place “Your Name”: Thread x started writing Thread x is currently writing Thread x finished writing – Your Name Thread y started writing Thread y is currently writing Thread y finished writing – Your Name Thread z started writing Thread z is currently writing Thread z finished writing – Your Name Part 3: Interrupt handling (30%) In Java multithreading environment, one thread can send an interrupt to another by calling the interrupt() method on the Thread object for the target thread (i.e., the thread to be interrupted). To handle interrupts in a target thread, Java allows two approaches. One is performed by writing an exception handler for InterruptedException (only applicable if the target thread is invoking methods which throw that exception such as sleep). The other approach is performed by periodically checking the interrupt status flag [login to view URL] and performing the handling routine when that flag is set to true. Write a Java program that illustrates the use of the two approaches described above. Your program should start by creating two threads, each thread should use different interrupt handling approach. Then, the program needs to send interrupts to each one of the created threads such that a thread needs to return (i.e., stop execution) after receiving an interrupt from the main thread. Make sure to output (print out) the status of each thread before and after being interrupted. Submission: 1. The output from each program i.e. three parts (you may use screenshots). 2. The source code for each program in (.java) format.
ID-ul proiectului: 28120792

Despre proiect

8 propuneri
Proiect la distanță
Activ: 3 ani în urmă

Vrei să câștigi bani?

Avantajele de a licita pe platforma Freelancer

Stabilește bugetul și intervalul temporal
Îți primești plata pentru serviciile prestate
Evidențiază-ți propunerea
Te înregistrezi și licitezi gratuit pentru proiecte
8 freelanceri plasează o ofertă medie de $36 USD pentru proiect
Avatarul utilizatorului
Hi there Contact me will all your project details to discuss it further. I am a senior programmer with practical development experience in various programming languages. I can provide a quality solution for your project. Thanks Farah Khan
$30 USD în 2 zile
4,9 (506 recenzii)
7,4
7,4
Avatarul utilizatorului
Hi there - I have many years of java threads experience and I can help you. This is a simple java program. Please reply, we can discuss further and hopefully get it started soon. Thank you!
$28 USD în 1 zi
4,9 (112 recenzii)
5,8
5,8
Avatarul utilizatorului
Hi Greetings! I have expertise i java and multithreading and synchronization . Please assign this to start immediately Thanks MDS
$50 USD în 2 zile
4,9 (38 recenzii)
5,4
5,4
Avatarul utilizatorului
Hello! ★★★★★ The Best Java Developer ★★★★★ I read your job description carefully and I understand what you want. I'm a Professional Java Developer with 6+ years of experience and will strongly assist you well for the work, as per your requirements. Please share the complete requirements of the project so that I can start working on it immediately. Let's have a detailed discussion for better scope of the project. I am waiting for your response. I am able to use all types of communication methods and able to maintain your time schedule during the project. Regards
$20 USD în 1 zi
5,0 (10 recenzii)
3,8
3,8
Avatarul utilizatorului
Backend programming and Multi-threading in particular is my bread and butter. I work as a backend java developer full time, so I get to implement multi-threading on regular basis in enterprise application. I feel confident about your requirement and can deliver on time. Please reach out to me in chat to discuss further.
$35 USD în 1 zi
5,0 (2 recenzii)
3,2
3,2
Avatarul utilizatorului
Hey, I can complete all of your three tasks. I've experience in multi-threading and Java. Feel free to discuss.
$30 USD în 2 zile
5,0 (8 recenzii)
2,7
2,7

Despre client

Steagul SAUDI ARABIA
riyadh, Saudi Arabia
5,0
9
Metoda de plată a fost confirmată
Membru din mai 28, 2017

Verificarea clientului

Mulțumim! Ți-am trimis prin e-mail linkul pe care trebuie să-l accesezi pentru a revendica creditul gratuit.
A apărut o eroare la trimiterea e-mailului. Încearcă din nou.
Utilizatori înregistrați Totalul proiectelor postate
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Se încarcă previzualizarea
S-a oferit permisiunea de depistare a locației.
Ți-a expirat sesiunea pentru conectare sau te-ai deconectat. Conectează-te din nou.