Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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. Process
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. Process A's FDT System File Table inode table 0 STDIN inode, // input offset, count 1 STDOUT 2 STDERR 3 inode, // output offset, count 4 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