Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions

Question

Have I incorporated my research into my outline effectively?

Answered: 1 week ago