Find Jobs
Hire Freelancers

Threads & Synchronization

$10-30 USD

Closed
Posted almost 4 years ago

$10-30 USD

Paid on delivery
Due date: 7 june Objective The objective is to develop a multithreaded application using pthreads for flower delivery. Clients will make requests for flowers, a central thread will collect those requests, and then delegate the work to the closest florist that has the kind of flower requested. How You are provided with a file containing the list of florists and the type of flowers that they sell (they have an infinite amount of each). e.g. Ayse (10,25; 1.5): orchid, rose, violet means the florist Ayse sells the three mentioned types of flowers, and her shop is located at location (10,25) in a cartesian 2D grid and her deliveries are made with an average speed of 1.5 clicks per ms. The file also contains the requests made by clients: e.g. client1 (55,76): orchid means that client1 is located at (55,76) and has made a request for a single romantic orchid. Your central/main thread will have a pool of one thread for every florist. Then it will start processing the clients’ requests one by one. For each request, it will delegate it to the closest florist with respect to the client using the Chebyshev distance. The florist receiving a request (i.e. a flower order) will prepare it and deliver it, by printing on screen how long it took it in total (= time of preparation + time of delivery; use the speed and distance information). The preparation of every order at the florist requires a uniformly random amount of time between 1 to 250 ms (closed interval). You can simulate it by letting the thread sleep for a random duration (equal to the time of preparation + time of delivery). Important: the central thread must process the requests as fast as possible, that means it should delegate the request to the closest florist even if she/he is busy preparing/delivering a request in the meantime (hint: you could use a request queue for each florist). Once all requests have been processed, all florist threads should terminate and return their sale statistics (i.e. how much time each florist spent in total for preparing and delivering the requests) to the central thread which will then print on screen that information in a nicely formatted table along with the number of requests handled by each client. If everything goes well your application should print on screen something similar to the following (the numbers are made up): $floristApp -i [login to view URL] Florist application initializing from file: [login to view URL] 3 florists have been created Processing requests Florist Fatma has delivered a clove to client2 in 56ms Florist Murat has delivered a rose to client0 in 145ms Florist Murat has delivered an orchid to client1 in 77ms … All requests processed. Ayse closing shop. Murat closing shop Fatma closing shop. Sale statistics for today: ------------------------------------------------ Florist # of sales Total time ------------------------------------------------ Ayse 7 1543ms Fatma 3 750ms Murat 6 1343ms ------------------------------------------------ Rules: • Solve any and all synchronization issues using only mutexes and/or condition variables. • If the command line arguments are missing/invalid your program must print usage information and exit. • You can assume the file is not empty and that its contents have the proper expected format. • Each thread should free allocated resources explicitly. • Never allow zombie processes! • In case of CTRL-C make sure your program (and all its threads) shuts down gracefully, by deallocating all resources and printing an informative message. • Don’t use busy waiting of any kind, don’t use timed waiting, or trylock. There should be a makefile & readme for this work. Code will be test in valgrind, so there should be no errors, no warnings, no memory leaks.
Project ID: 25742820

About the project

7 proposals
Remote project
Active 4 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
7 freelancers are bidding on average $61 USD for this job
User Avatar
I can do your task for a few hours time. C and Pthreads are one of my top skills. Thank you..........
$50 USD in 1 day
4.9 (431 reviews)
7.3
7.3
User Avatar
HI..I am proficient in C programming for writing multithreaded programs using POSIX threads and processes with inter thread/process communication and can complete the project in C as per given specs.
$100 USD in 2 days
4.9 (149 reviews)
6.2
6.2
User Avatar
Hi, I have strong background in Programming and experience in Threads in C. Let me help you. I am ready to start.
$100 USD in 4 days
5.0 (9 reviews)
4.0
4.0
User Avatar
Hi, there! Glad to see you. C/C++/C# programming are my major developing skills as you can see in my review. GUI and console platform are both possible to develop and I can show you my previous work result if you want. I can implement your creative idea to reality immediately. I am looking for a long term relationship. waiting for your valuable reply… Thanks. Regards.
$100 USD in 7 days
5.0 (10 reviews)
3.6
3.6
User Avatar
Hello, My name is Aqeel Ahmed, I've complete MS Software Engineering. I've 5-Year experience in software development and algorithm implementation. My Core Expertise in Java - C++ - C - C# - SQL - object-oriented - Data Structure - Swing - OpenGL - JavaFX. Look at my profile and Important Reviews: https://www.freelancer.com/u/ExpertSoul I'm excited with feeling that I would be able to satisfy your requirements Within Deadline. Please leave a message on my chat so we can discuss the project. Thank.
$20 USD in 4 days
4.7 (6 reviews)
3.5
3.5
User Avatar
Hello. I have great experience with thread synchronization using the C pthread library. I have done many such projects when I was in college for me and my colleagues. Message me if you want to discuss more details
$50 USD in 5 days
5.0 (1 review)
1.0
1.0
User Avatar
This is my first project in freelancing platform. I want to do it for free but I had to place minimum bid of dollar 5. I am having nearly 3 years of working experience in fortune 500 companies in C/C++ Linux domain. It would be pleasure to work with you. Looking forward go get first project in freelancing platform. Thank you and have a great day. :)
$10 USD in 5 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of TURKEY
kocaeli, Turkey
4.8
2
Payment method verified
Member since Nov 26, 2018

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.