Spring 2024 - CS609 - 2
Spring 2024 - CS609 - 2
Instructions:
Please read the following instructions carefully before submitting an assignment. It should be
clear that your assignment will not get any credit if:
▪ You have not fulfilled all the requirements described in problem statement.
▪ Assignment is copied (partial or full) from any source (websites, forums, students,
1. You need to upload the following two files in a single .zip or .rar format:
(i) .CPP file (C++ source file, containing code)
(ii) .exe file (executable file, created after compilation)
2. Any other file type (.docx, .txt, .pdf, .jpeg, .gif) shall not be acceptable and you would get
zero marks for this.
Topics Covered:
70 to 120
Problem Statement:
Write a C++ program that copies a file from one location to another using multiple threads to read and
write the file in chunks. This will involve using the Windows API for process and thread management,
as well as file I/O operations.
Assignment Tasks:
1. The program should take three command-line arguments:
Source file path
Destination file path
Number of threads to use
2. Use the Windows API to open the source and destination files.
3. Divide the file into chunks and assign each chunk to a separate thread.
4. Each thread will read its assigned chunk from the source file and write it to the destination file.
5. Ensure correct synchronization and handle any potential errors during file operations.
6. Measure and display the time taken to copy the file using the specified number of threads.
Output Requirements:
1. After taking the inputs, program should display the following information as the output:
a. Files Size
b. Thread number
c. Number of bytes copied by each thread
d. Offset from where data was copied
e. Total time taken to copy the file.
Sample Output:
Note:
You should print your student ID at the top of output screen. You will be awarded zero marks if
the mentioned student ID is not yours.
In case of any assignment related query, please do not post any question on MDB. Contact at
[email protected] for asking assignment related questions.
---BEST OF LUCK---