Question: Operating system File system question. please answer question 4,file size. Both 100,200,300,400 are incorrect Hint: The function write(i, m, n) copies n bytes from memory
Operating system File system question.
please answer question 4,file size. Both 100,200,300,400 are incorrect

Hint:
The function write(i, m, n) copies n bytes from memory M starting at location m to the open file i, starting at the current position. The function performs the following tasks:
- Compute the position within the r/w buffer that corresponds to the current position within the file
- Copy bytes from memory, starting at M[m], to the r/w buffer, starting at the current position, until one of the following occurs:
- The desired count n is reached or the maximum file size is reached:
- Update current position in OFT
- If current position > size, then update size in the OFT and in the descriptor
- Exit with success: display number of bytes written
- The end of the buffer is reached:
- Copy the r/w buffer into the appropriate block on disk
- If the sequentially next block exists, then copy it from the disk into the r/w buffer
- Otherwise, use the bitmap to find a free block and record it in the file descriptor
- Update the bitmap accordingly
- Continue copying bytes from the memory into the r/w buffer until again one of the above events occurs
- The desired count n is reached or the maximum file size is reached:
X Question 1: Make the following assumptions: The descriptor of a file contains the values (700, 70, 30, and 0) The file is open at the OFT index 3 The current position within the file is 200 The next free block is block 40 Show the values after executing the function: write(3, m, 100) 1. Current Position: 2. Block currently in the r/w buffer: 3. Offset within the r/w buffer: 4. File size: Type: Fill In The Blank Points Awarded: 0.000/1.000 User Answer(s): 300 Answer 1 Rationale: the current position is advanced from 200 by 100 bytes 70 Answer 2 Rationale: the new position is still within the same block: 300/512 = 0, which is block 70 as shown in the descriptor 300 Answer 3 Rationale: 300 mod 512 = 300 & 100 Answer 4 Rationale: the file has not expanded; the 100 bytes have overwritten a portion of the existing contents X Question 1: Make the following assumptions: The descriptor of a file contains the values (700, 70, 30, and 0) The file is open at the OFT index 3 The current position within the file is 200 The next free block is block 40 Show the values after executing the function: write(3, m, 100) 1. Current Position: 2. Block currently in the r/w buffer: 3. Offset within the r/w buffer: 4. File size: Type: Fill In The Blank Points Awarded: 0.000/1.000 User Answer(s): 300 Answer 1 Rationale: the current position is advanced from 200 by 100 bytes 70 Answer 2 Rationale: the new position is still within the same block: 300/512 = 0, which is block 70 as shown in the descriptor 300 Answer 3 Rationale: 300 mod 512 = 300 & 100 Answer 4 Rationale: the file has not expanded; the 100 bytes have overwritten a portion of the existing contents
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
