Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8209211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:38:34+00:00 2026-06-07T09:38:34+00:00

Unix kernel represents open files using three data structures: Descriptor table , File table

  • 0

Unix kernel represents open files using three data structures: Descriptor table, File table, and v-node table.
When a process opens a file twice, it gets two different descriptors in the descriptor table, two entries in the file table(so that they have different positions in the same file), and they both point to one entry in the v-node table.
And child process inherits parent process’s descriptor table, so kernel maintains one descriptor table for each process respectively. But two descriptor from different processes point to the same entry in open file table.
So

  1. When child process does some read on the file, would the offset of the same file change in parent process?
  2. If 1 is true, for two processes, is there a convenient way that I can get the same effect of fork on same file? That means two processes share a position(offset) information on the same file.
  3. Is there a way to fork so that both processes have totally unrelated tables, like two unrelated processes only that they opened same files.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:38:36+00:00Added an answer on June 7, 2026 at 9:38 am

    When child process does some read on the file, would the offset of the same file change in parent process?

    Yes, since the offset is stored system-wide file table. You could get a similar effect using dup or dup2.

    If 1 is true, for two processes, is there a convenient way that I can get the same effect of fork on same file? That means two processes share a position(offset) information on the same file.

    There is a technique called “passing the file descriptor” using Unix domain sockets. Look for “ancillary” data in sendmsg.

    Is there a way to fork so that both processes have totally unrelated tables, like two unrelated processes only that they opened same files.

    You have to open the file again to achieve this. Although it doesn’t do what you want, you should also look for the FD_CLOEXEC flag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Unix, I have got three main files. One of them is a library
I'm a bit confused about the understanding of a mode switch in Unix kernel.
Unix 'file' command has a -0 option to output a null character after a
In Unix we can suspend a process execution temporarily and resume it with signals
On Unix, everything is a file, so you can use file i/o functions with
The UNIX sort command can sort a very large file like this: sort large_file
On Unix, we can specify the ftp username/password in ~/.netrc file and next time
I would like to learn about linux/Unix kernel programming for scalable multi processors (smps).
I am trying to hack an old unix kernel. I just want to implement
Unix time from MySQL table: 1328422844 posted via date('U') (translates to 2012-02-04 22:20:44) Displays

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.