CS 4953 Experimentation in Computer Science Assignment 1: Spring 2003
Rescheduled due Tuesday, February 11, 2003
Do the first 2 items from Exercise Section 12.7 from the notes.
The main program should also report the total number of bytes and files
copied.
Join the threads only after all threads have been created.
You can use the readdir function to read the source directory.
Note that this is not thread-safe, but it will be only called by the
copydirectory thread, so it is OK to use, since it is called by only
one thread.
Only copy regular files and do not traverse subdirectories.
You might find the following function useful:
#include <sys/stat.h>
#include <sys/types.h>
int isregular(const char *filename) {
struct stat buf;
if (lstat(filename, &buf) == -1)
return 0;
return S_ISREG(buf.st_mode);
}
Use one of the timing techniques from the notes or Assignment 0 to time how long
it takes to copy all of the files. Create a test source directory
that contains a reasonable number of regular files, say between 20 and 100.
You can use small files, large files, or a mixture. Make sure the total
time is considerably greater than you timing resolution.
You can do this in our Sun lab, or on your own Linux or MAC OS X system.
Do at least two different tests involving different types of source and
destination locations. In each case compare the time needed in your
threaded implementation to just using the cp command.
Here are some possibilities for source and destination directories. Choose
at least 2 to try.
- Both on the same local hard disk.
In the Sun lab, try using directories created in /tmp.
- On two different local disks.
I don't think you can do this in our lab, but you might be able to at home.
- One local disk and one remote (e.g., NSF) disk.
In the Sun lab, use /tmp and a directory in your account.
This can be done with either as the source, but do not do it both ways
and count it as the only two different types you try.
- Both on the same remote disk, e.g. directories on your account.
- On two different remote disks. You might have to get access to
a directory on friend's account on our Sun system to try this one.
Turn in the source code, lint output, and output of your programs.
Write a short report describing your results and giving your conclusions.
Make sure you describe the systems you are using with some indication of the
size and number of files in the source directory.
Use this cover sheet.