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

  The mode of a list of values is the score

For this project you will write a program to compute the arithmetic mean (average), median, and mode for the values read in from TopicFin.txt. The program results will be written to TopicFout.txt.

  Show that curve lies lies on intersection of the cylinders

show that the curve lies lies on the intersection of the cylinders y=[2(z+1)^2]/9 and x=[(z+1)^4]/81

  Persuade your team to give time to organization

Discuss whether you should accept this demand from your manager or whether you should persuade your team to give their time to the organization rather than to their families.

  Transferring of videos and music files between computers

Transferring of videos and music files between computers

  What is being proposed if net neutrality is implemented

One of the current 'hot topics' is Net Neutrality. Explain what net neutrality refers to, what is being proposed if net neutrality is implemented, and give your opinion as to what should or should not be done and why.

  Financial impact of change on wvu students

Currently, PRT riders who are not WVU students or employees must pay $0.50 per trip. Assume that this charge was eliminated.

  Show how an assembly might replace this pseudo-instruction

show how an assembly might replace this pseudo-instruction with the true instructions to achieve the same effect. You solution must observe MIPS register use conventions.

  Write a flowchart with single alternative decision structure

Write a flowchart with a single alternative decision structure that assigns 0 to the variable b and assigns 1 to the variable c it the variable a is less than 10

  Distinct integers that has the following property

You have an array A[0], A[1], ..., A[n - 1] of distinct integers that has the following property:The values in the array increase up to index p for some p between 0 and n - 1, and then decrease for all indices beyond p through positio

  How would you create a monospaced font of point size 20

How would you create a Monospaced font of point size 20 that is bold? Give the Java statement needed.

  Discuss the issues that managing and implementing

Discuss the issues that managing and implementing the technology architecture you would have and how you would overcome these challenges. Be sure to discuss at least three challenges.

  Create a japplet that contains a jlabel and jbutton.

Create a JApplet that contains a JLabel and JButton. You'll create a JButton that will automatically change font typeface, style, and size when clicked by the user. Change the font typeface, style, and size on the JLabel.

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