Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please give me some explaination if possible. Again its regarding C programming.

ID: 3873686 • Letter: P

Question

Please give me some explaination if possible. Again its regarding C programming.

Give C-like pseudocode for solving the following problem with OpenMP: compress the contents of a directory.

You may use recursion if you want. Assume that your function will look like: file_list compress(char[] foldername) where file_list is a list of files. You should assume that there is an existing function called: file get_compressed(char[] filename) that compresses a file and void add_to_list(file_list fl, file f) that adds a file to a list. Be careful not to generate an exponential number of threads.

Explanation / Answer

file_list compress(char[] foldername){

file_list fl ={};

#pragma omp parallel

for each filename fn in the folder{

/* If there is a subfolder */

if(isFolder(fn)){

add_to_list(fl,compress(fn));

}

else{

file f=get_compressed(fn);

add_to_list(fl,f);

}

}

}