C/C++ programs using POSIX pthread library.

Cancelado Publicado Sep 26, 2012 Pagado a la entrega
Cancelado Pagado a la entrega

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.

Programación en C Linux UNIX

Nº del proyecto: #2780020

Sobre el proyecto

5 propuestas Proyecto remoto Activo Oct 18, 2012

5 freelancers están ofertando un promedio de $21 por este trabajo

CDErrors

See private message.

$21.25 USD en 3 días
(4 comentarios)
2.5
arjunsuresh1987

See private message.

$20.4 USD en 3 días
(5 comentarios)
2.4
myhao840430

See private message.

$21.25 USD en 3 días
(0 comentarios)
0.0
arifonly

See private message.

$20.4 USD en 3 días
(0 comentarios)
0.0
srikanthakula

See private message.

$20.4 USD en 3 días
(0 comentarios)
0.0