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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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