Threads & Synchronization

Due date: 7 june


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



• 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.

Taidot: C-ohjelmointi, Linux

Näytä lisää: thread synchronization in java simple example, thread synchronization c, thread synchronization in c, static synchronization in java, thread synchronization c#, synchronized class in java, synchronization in os, inter thread communication in java, php processing speed test, created website ebaycom, automated web site processing, php processing indicator, website created joomla, dynamically created gridview sorting, created 1000 blogs, saving user created drawings server flash, oscommerce website payments pro transaction processing, syntax structures sentence processing, jobs created due ecommerce, map created processing

Tietoa työnantajasta:
( 2 arvostelua ) kocaeli, Turkey

Projektin tunnus: #25742820

7 freelancers are bidding on average $61 for this job


I can do your task for a few hours time. C and Pthreads are one of my top skills. Thank you..........

$50 USD 1 päivässä
(431 arvostelua)

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 2 päivässä
(149 arvostelua)

Hi, I have strong background in Programming and experience in Threads in C. Let me help you. I am ready to start.

$100 USD 4 päivässä
(9 arvostelua)

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 wan Lisää

$100 USD 7 päivässä
(10 arvostelua)

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 - Dat Lisää

$20 USD 4 päivässä
(6 arvostelua)

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 5 päivässä
(1 arvostelu)

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. Lisää

$10 USD 5 päivässä
(0 arvostelua)