Hello and welcome.
In this session we can see different file tables together such as file descriptor table which is per
process, open file table which is a system wide.
That means all the processes are able to see this open file table.
And we have the inode table structure here.
Each entry corresponds to a inode table.
Now when a user calls open system call on log dot txt file in read write mode.
What happens here is the log dot.
TXT will have entry in the inode table.
For example here if we specify o underscore create in open system call, then.
If this file is not present, it will be created and a inode table is also created.
And the entry of the file in this inode table will be registered.
Or in case the file is already present, the entry of this file in the inode table is also already present.
Now, when the user mode program opens a file for read write operation, the file descriptor table is
updated with the next available.
In this case, three is the next available number and three will be assigned to the.
And the pointer to the open file table will point to the entry in the open file table.
This contains the file offset.
Bolstered his flag.
In our case, we have opened file in read write mode.
So file status flag contains the read write flag and pointer to the inode points to the inode.
Table of log dot txt.
Let's say that the log dot txt already contains six bytes of data, and if we do a seek with seek end,
then the file offset will point to the end of the file and contains value six.
If a user performs a write operation on the file and adds some extra three bytes of data to log dot,
txt, the file offset in open file table will be updated to nine from six.
This is how the file offset gets updated.
Now the file offset is pointing to the end of the file.
If a user calls Elsik and specifies seek set and specifies zero bytes, then the file offset points
to the initial byte and the offset will be updated to zero.
This is how the internal offset will be updated, and it points to the location from which the next
byte of the file is read or written.
So this is the diagram which connects all the different tables like file descriptor table, open file
table and the inode table together.
In next video session we will learn the dupe system call.
Thank you.