Question: 1 . ( 1 5 ) Briefly describe the semantics of the Unix system calls listed below. Place your descriptions in a plain text file

1.(15) Briefly describe the semantics of the Unix system calls listed below. Place your descriptions in a
plain text file named syscalls.txt
a. getpid();
b. getppid();
c. open();
d. read();
e. write();
f. close();
g. chmod();
2.(20) Write a program that uses each of the above system calls at least once. Comment your code and
submit it in a file named syscalls.cpp
3.(20) Consider the evolution of computers in general and the increase in processor speed in particular.
Suppose we were to design a system with a processor that is clocked at 3GHz. Further, let us suppose
that signals in our system can propagate at 80% of the speed of light. Determine the maximum
distance between the CPU and Memory (or Cache) if we want to access data within one processor
cycle. Provide your answer and a description of how you arrived at this answer in a plain text file
named length.txt.
4.(45) Write a small program that copies data from a file A to a file B. For different file sizes 1KB 128MB
(doubling the file size in each step). So, you will create 18 different files with files sizes 1KB,2KB,4 KB,
8KB and so on. Record the time your program requires to complete the copy when using read() and
write() system calls for each byte that is being copied. Generate a graph that depicts the program
performance (you can create a graph in excel). In the graph, x-axis should be different number of file
sizes and y-axis should be the total time (in seconds) to complete copying files.
Briefly describe what you observe and investigate if you can improve the programs performance. For
this program it is imperative that file A and file B are located on the local disk. For submission,
a) Provide your source code in a file named copying.cpp
Note: you must use system calls (read and write) otherwise you will not get the points.
Your program should take file names (source and destination) from the command line
and do not hard code the file names.
Add error handling codes such as file not available, error opening files etc.
Add comments in your code.
b) Provide your graph in a file named copying.jpg
c) Provide your description in a file named copying.txt
Note that you may use truncate command in Linux to create dummy files with specific file sizes. Also,
you can use time command in Linux to collect exact time taken by your program to complete
execution.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!