Code Monkey home page Code Monkey logo

fs-demo's People

Contributors

pwmarcz avatar

Watchers

 avatar  avatar  avatar

fs-demo's Issues

Two processes doing mmap

How do we plan to tackle the case where two processes:

  1. Access the same file
  2. At least one of them uses mmap()
  3. At least one of them has write permission

Do we consider this case unlikely and thus fail on it? Like, when the second file tries to do an mmap() on the already-opened file (by another process), we return an error?

Deadlock on syscalls like rename() and sendfile()

When a syscall operates on two files, there seems to be a possibility of a deadlock.

A trivial example would be:

  1. First process does rename("foo.txt", "bar.txt")
  2. Second process does rename("bar.txt", "foo.txt")

Roughly at the same time. Another example would be sendfile().

Or maybe there is no problem actually? The Server can impose some ordering to prevent deadlocks?

What does server state contain exactly?

From the README and diagrams, it's hard to understand what kind of Server state is kept. Also, it's not obvious what is the relationship between Dentries and Handles.

From what I understand:

  • Server keeps all known dentries; they are never removed
    • Each dentry has a canonical path + some file metadata
    • Each dentry has a list of associated handles (? I imagine this is needed to propagate things like "file was removed")
  • Server keeps all known handles
    • Handles are removed when closed by all clients
    • Each handle references a corresponding dentry (which may be in "negative" state if file was removed)

Also:

  • Several clients may use the same handle (depicted on the second diagram)
    • All their accesses to this handle will be synchronized by the server (including the position pointer)
  • Several clients may use two handles backed by the same dentry (not depicted on diagrams, but I guess similar to the first diagram)
    • All their accesses to these handles with the same underlying dentry will be synchronized by the server (but not the position pointer)
  • Clients that use handles backed by different dentries are never synchronized by the server (except for corner cases of rename and sendfile and maybe some more).

Is this understanding correct?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.