Find Jobs
Hire Freelancers

C/C++ programs using POSIX pthread library.

$20-25 USD

Cancelled
Posted over 11 years ago

$20-25 USD

Paid on delivery
Implement some multi-threaded C/C++ programs using POSIX pthread library. Based on your previous file operation experience in machine problem 1, now you will implement some multi-threaded file copy programs. 1. Based on the file operation program you have written in machine problem 1, write a simple C/C++ program copyfile1.c that copies all files in a given source directory to another given destination directory (both directory names are given in the parameters). You may use functions such as opendir(), readdir(), closedir() to access directories. 2. Write a multi-threaded version (mcopyfile1.c) of the previous program. You will create multiple threads using pthread library and each thread will be in charge of copying a distinct file. To compile the program using pthread, remember to use “-lpthread?? option in gcc (e.g., “gcc ??"o mcopyfile1 mcopyfile1.c ??" lpthread??). 3. Measure the performance (using time command in Linux as you did before) of copyfile1 and mcopyfile1 on directories with different number/size of files. Which one is faster under which condition? Use a graph to show the performance difference (e.g., xaxis is the number of files and y-axis is the copy time). Explain the difference. 4. Write a simple C/C++ file copy program copyfile2.c that copies a given (single) source file to a given destination file (both file names are given in the parameters). Then write a multi-threaded version mcopyfile2.c using pthread library (each thread is in charge of copying a portion of the file). Please use a divide-and-conquer strategy for file copying. That is, given a file, intelligently decide how many parts to divide (e.g., decide how many threads to use, the starting/ending position of file pointers in each thread). [Hint: it’s not always a good idea to use as many threads as possible. Why?] 5. Measure the performance of copyfile2 and mcopyfile2 when copying a single file with various file sizes and various numbers of threads. Which one is faster under which condition? Use a graph to show the performance difference. Explain the difference. Explain how to obtain best divide-and-conquer setting (e.g., how do you split the file, what size for each portion, how many threads) based on your empirical experience and validate your claim with experiments.
Project ID: 2780020

About the project

5 proposals
Remote project
Active 12 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
5 freelancers are bidding on average $21 USD for this job
User Avatar
See private message.
$21.25 USD in 3 days
5.0 (4 reviews)
2.5
2.5
User Avatar
See private message.
$20.40 USD in 3 days
5.0 (5 reviews)
2.4
2.4
User Avatar
See private message.
$21.25 USD in 3 days
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$20.40 USD in 3 days
0.0 (0 reviews)
0.0
0.0
User Avatar
See private message.
$20.40 USD in 3 days
0.0 (0 reviews)
0.0
0.0

About the client

Flag of RUSSIAN FEDERATION
Stavropol, Russian Federation
5.0
286
Payment method verified
Member since Jul 5, 2002

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.