Giter Site home page Giter Site logo

ozgurhepsag / parallel-file-copy-asynchronous-io Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 9 KB

This is a C program that copies a text file to a defined destination path using Asynchronous I/O operations.

C 100.00%
asynchronous-io c asynchronous thread pthreads multithreading

parallel-file-copy-asynchronous-io's Introduction

Parallel File Copy (Async I/O)

Task

In this assignment, you are expected to copy a text file to a defined destination path using Asynchronous I/O operations like download manager. You will copy the content of source file (source.txt) to a new destination file (destination.txt).

  • You will take 3 input parameters.

    o Source path (- (dash) means same path as executable file) o Destination path (- (dash) means same path as executable file) o Number of threads

  • Source and destination paths can be given as real paths OR as the character (– dash) which means that related txt file will be created under the same path as executable file.

  • Define a function to prepare a source file randomly. The content of the source file must be readable. You will create the source file in main thread. (max size of file 100 MB)

  • For example; let’s say that the user enters 8 threads and the size of the source file as 16 bytes. So each thread must copy 2 bytes for each. In order to be readable, your source file must be created randomly as “aabbccddeeffgghh”.

    o 1st thread should copy from source.txt to destination.txt first 2 bytes > aa

    o 2nd thread should copy from source.txt to destination.txt second 2 bytes > bb

    o …

    o 8th thread should copy from source.txt to destination.txt last 2 bytes > hh

  • Create threads (user will be able to define the number of threads from 1 to 10) for asynchronous I/O copy process (read + write).

  • Finally, the source.txt file is the exact same content with the destination.txt file.

  • For testing this, you should apply MD5 checksum to verify. MD5 (Message Digest 5) sums can be used as a checksum to verify files or strings in a Linux file system.

  • https://www.tecmint.com/generate-verify-check-files-md5-checksum-linux/

  • An Example to command-line interface

    o ./run.out - - 8 (Put a space between each parameter.)

    General Requirements:

  • For this assignment you will work individual.

  • The POSIX AIO and pthread libraries will be used in C prog. lang..

  • We compile your code on Debian 8 OS with this code:

    o gcc -lrt -c your_code_file.c

    o gcc your_code_file.o -lrt -o your_code_file.out

parallel-file-copy-asynchronous-io's People

Contributors

ozgurhepsag avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.