Find Jobs
Hire Freelancers

java micro app

$10-30 USD

Cerrado
Publicado hace más de 3 años

$10-30 USD

Pagado a la entrega
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 del proyecto: 28120792

Información sobre el proyecto

8 propuestas
Proyecto remoto
Activo hace 3 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
8 freelancers están ofertando un promedio de $36 USD por este trabajo
Avatar del usuario
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 en 2 días
4,9 (506 comentarios)
7,4
7,4
Avatar del usuario
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 en 1 día
4,9 (112 comentarios)
5,8
5,8
Avatar del usuario
Hi Greetings! I have expertise i java and multithreading and synchronization . Please assign this to start immediately Thanks MDS
$50 USD en 2 días
4,9 (38 comentarios)
5,4
5,4
Avatar del usuario
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 en 1 día
5,0 (10 comentarios)
3,8
3,8
Avatar del usuario
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 en 1 día
5,0 (2 comentarios)
3,2
3,2
Avatar del usuario
Hey, I can complete all of your three tasks. I've experience in multi-threading and Java. Feel free to discuss.
$30 USD en 2 días
5,0 (8 comentarios)
2,7
2,7

Sobre este cliente

Bandera de SAUDI ARABIA
riyadh, Saudi Arabia
5,0
9
Forma de pago verificada
Miembro desde may 28, 2017

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.