Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Unix I/O and File operations with inheritance of file descriptors. Suppose that the File Descriptor Table (FDT), System File Table (SFT) and in-memory inode tables
Unix I/O and File operations with inheritance of file descriptors.
Suppose that the File Descriptor Table (FDT), System File Table (SFT) and in-memory inode tables are as follows after a process A just starts. System File Table inode table Process A's FDT STDIN STDOUT STDERR inode, // input offset, count inode, // output offset, count inode, // error offset count user space kernel Suppose that a data file "mydatafile.txt" contains "1234567890", and file operations incur no error. Show the resulting FDT, SFT and inode table after the following code of process A is executed. Also, discuss what are the possible outputs. Code a) : int fd; char buf[5] = "WXYZ" ; fd = open("mydatafile.txt", O_RDONLY); fork(); read (fd, buf, 1); read (fd, buf+1, 1); printf ("%cfc ", buf[0], buf[1]); Code b): int fd; char buf[5] = "WXYZ" ; fork(); fd = open ("mydatafile.txt", O_RDONLY); read (fd, buf, 1); read (fd, buf+1, 1); printf ("%cfc ", buf[0], buf[1])Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started