A file from the program''s standard input

Assignment Help Basic Computer Science
Reference no: EM13714919

Write a mycopy program that shall copy a file from the program's standard input (stdin) to its standard output (stdout). You are allowed to use only the functions open/read/write/close for I/O: no other I/O functions (such as fprintfprintffscanfscanf) shall be used, except for the user interaction (such as error reporting or printing help messages). The user shall specify the size of the read/write buffer (the number of bytes the program reads/writes "in one shot") on the command line. The data from the original file shall be redirected to the program's standard output, and the standard output of the program shall be redirected to the target file, e.g.:

mycopy 1024 < myfile.orig > myfile.copy

In this example, your program mycopy copies the content of the file myfie.orig into a new file myfile.copy in 1024 byte chunks. Remember that the last fragment of the input file can be shorter than B bytes.

Besides copying the file, the program measures its running time using the gettimeofday function, and reports the result to the standard error output (stderr).

For an arbitrary 10MB file, plot the program running time T against the buffer size B for B=5B, 10, 15, 20, 25, 50, 75, 100, 250, 500, 1kB, 1250B, 2500B, 5kB, 10kB, 25kB, 50kB, 100kB, 250kB, 500kB, 1MB (you may need to use log-log axes). Explain the chart.

You can use dd to create a 10MB zero-filled file named "/tmp/myfile":

dd if=/dev/zero of=/tmp/myfile count=5kB bs=1000

Submit the program source code and the chart. Suggestion: use gnuplot to produce the chart. Do not discard the data you collected to build the chart: you will need them in the future.

 

Reference no: EM13714919

Questions Cloud

Determinants of income differences : Determinants of Income Differences. Identify one of the determinants of income differences as enumerated in Chapter 30 which you have personally observed or desire to research. Be certain to tell us what you believe was the most significant ec..
Assume that the market for wheat is perfect competitive : Assume that the market for wheat is perfect competitive, with demand curve P = 5000 - 0.01QD and a supply curve P = 1+0.1QS. Each identical wheat producer has a total cost curve given by T C = 1+Q+Q2  which results in marginal cost of MC = 1 + 2Q.
What of the importance of cloud computing : Describe the current state (such as its three layers (Iaas/Paas/Saas)) and future state of Cloud Computing. And explain why, how, and what of the importance of cloud computing. The answers should have at least two pages.
How can they be resolved explain : What are some of the typical problems a project team may encounter during a project's life cycle? How can they be resolved? Explain.
A file from the program''s standard input : Write a mycopy program that shall copy a file from the program's standard input (stdin) to its standard output (stdout). You are allowed to use only the functions open/read/write/close for I/O: no other I/O functions (such as fprintf, printf, fscanf,..
The federal government uses many techniques : The federal government uses many techniques to ensure that multiple high officials are not exposed to the same vulnerabilities at the same time. For example, the president and the vice-president would be taken to separate safe areas in the even..
The ciso for chase bank--using the resources available : Assume to you are the CISO for Chase Bank--using the resources available at PBSC library, find out what laws your state has passed to prosecute computer crime specifically for financial institutions. Create a PowerPoint presentation directed to..
Select an existing piece of software : Select an existing piece of software, an application, a smart device, or anything with computer/software embedded in it, and imagine a new version to be built based on it, or imagine a brand new UI. Now perform the following:
Introduction to programming : Many financial experts advise that property owners should insure their homes or buildings for at least 80 percent of the amount it would cost to replace the structure.  Design a modular program that asks the user to enter the replacement cost ..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Write down sructured english for clyde-s narrative

On a trip lasting more than one day, we permit hotel, taxi, and airfare also meal allowances. Same times apply for meal expenses. Write down sructured English for Clyde's narrative of the reimbursement policies.

  How easy or difficult would it be initiate such advantages

More generally, to what extent do specific technologies help companies gain an edge over their competitors? How easy or difficult would it be to initiate such advantages?

  Identify all related tasks and resources

Identify all related tasks and resources needed to complete the scenario.

  Write a regular expression

Write a regular expression that matches a date in the usual format:   mm/dd/yy

  Discussion question arrays

Discussion question Arrays

  Who swallowed a spider

There was an old woman who swallowed a fly. I don't know why she swallowed that fly, Perhaps she'll die. There was an old woman who swallowed a spider,

  interlocking words on a Scrabble board

The board game Scrabble works by assigning points to wooden tiles that are marked with printed letters, and are arranged as interlocking words on a Scrabble board.

  Computer the value of the given number

Prompt the user for a number and an exponent. Computer the value of the given number (the base) raised to the power of the exponent.

  Which type of exception would be written as the parameter

Which type of exception would be written as the parameter of a catch-clause if the try-clause is calling new and we want to check whether the free store has run out of space? 16. What do you call the following function? bool operator==(Name otherN..

  What role does business intelligence play in competitive

What role does Business Intelligence play in competitive advantage and organizational strategy?

  What is the swap space amount for the bash command

If using a long listing and no process modifiers, what is the swap space amount for the bash command?

  F denotes false and t denotes true

F denotes false and T denotes True

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd