Question: Problem 1 Statement: In chapter 2, a program was discussed in class in which it copies the contents of a given input file into a

 Problem 1 Statement: In chapter 2, a program was discussed in

class in which it copies the contents of a given input file

Problem 1 Statement: In chapter 2, a program was discussed in class in which it copies the contents of a given input file into a destination file. The names of both files are obtained by prompting the user to input them. As discussed, such a program makes a heavy use of system calls where control is switched back and forth between user mode and kernel mode. The figure below illustrates how system calls are used in this particular case. source file destination file Example System Call Sequence Acquire input file name Write prompt to screen Accept input Acquire output file name Write prompt to screen Accept input Open the input file if file doesn't exist, abort Create output file if file exists, abort Loop Read from input file Write to output file Until read fails Close output file Write completion message to screen Terminate normally Page 1 of 2 Write such a program using Java. Your program MUST perform all necessary error checking and input validation including ensuring that the source file exists, ensuring that the copying process has been completed successfully, ensuring the output file is identical to the input one, etc. Once you have properly implemented your design and fully tested it to make sure it functions exactly as expected, you need to run the program using a utility that traces system calls. Hint, in Linux, you may use strace

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 Databases Questions!