。。。

This commit is contained in:
ridethepig 2023-04-14 19:41:13 +08:00
parent 8e6b4baeee
commit e2e7ebf256
3 changed files with 159 additions and 4 deletions

View File

@ -4175,5 +4175,119 @@
:height 1382.4}),
:page 498},
:content {:text "tandem"},
:properties {:color "green"}}],
:extra {:page 498}}
:properties {:color "green"}}
{:id #uuid "6438d8bf-19fd-4a4a-b491-3887c425aebf",
:page 498,
:position {:bounding {:x1 108.35715103149414,
:y1 931.4822082519531,
:x2 298.5384407043457,
:y2 952.0536193847656,
:width 806.3999999999999,
:height 1209.6},
:rects ({:x1 108.35715103149414,
:y1 931.4822082519531,
:x2 298.5384407043457,
:y2 952.0536193847656,
:width 806.3999999999999,
:height 1209.6}),
:page 498},
:content {:text "Files And Directories"},
:properties {:color "yellow"}}
{:id #uuid "6438dd4b-55ba-4649-90fd-7de69ed9c2ba",
:page 500,
:position {:bounding {:x1 108.35714721679688,
:y1 860.8839721679688,
:x2 232.83402252197266,
:y2 881.4554138183594,
:width 806.3999999999999,
:height 1209.6},
:rects ({:x1 108.35714721679688,
:y1 860.8839721679688,
:x2 232.83402252197266,
:y2 881.4554138183594,
:width 806.3999999999999,
:height 1209.6}),
:page 500},
:content {:text "Creating Files"},
:properties {:color "yellow"}}
{:id #uuid "6438dd78-68fe-47c6-8ca6-b2de3206f4f1",
:page 501,
:position {:bounding {:x1 567.5357360839844,
:y1 572.9910888671875,
:x2 675.8062438964844,
:y2 595.2767944335938,
:width 806.3999999999999,
:height 1209.6},
:rects ({:x1 570.982177734375,
:y1 572.9910888671875,
:x2 675.8062438964844,
:y2 595.2767944335938,
:width 806.3999999999999,
:height 1209.6}
{:x1 567.5357360839844,
:y1 574.732177734375,
:x2 575.9107360839844,
:y2 591.3035888671875,
:width 806.3999999999999,
:height 1209.6}),
:page 501},
:content {:text " file descriptor"},
:properties {:color "yellow"}}
{:id #uuid "6438e073-2636-4ec8-807d-3ecf83a5c0c0",
:page 502,
:position {:bounding {:x1 108.35714721679688,
:y1 414.08931732177734,
:x2 349.001220703125,
:y2 434.66075134277344,
:width 806.3999999999999,
:height 1209.6},
:rects ({:x1 108.35714721679688,
:y1 414.08931732177734,
:x2 349.001220703125,
:y2 434.66075134277344,
:width 806.3999999999999,
:height 1209.6}),
:page 502},
:content {:text "Reading And Writing Files"},
:properties {:color "yellow"}}
{:id #uuid "6438e88b-e3e6-44a4-9f79-411c1f27ae71",
:page 506,
:position {:bounding {:x1 108.35714912414551,
:y1 894.669677734375,
:x2 326.5652027130127,
:y2 915.2411193847656,
:width 806.3999999999999,
:height 1209.6},
:rects ({:x1 108.35714912414551,
:y1 894.669677734375,
:x2 326.5652027130127,
:y2 915.2411193847656,
:width 806.3999999999999,
:height 1209.6}),
:page 506},
:content {:text "Shared File Table Entries"},
:properties {:color "yellow"}}
{:id #uuid "6438e98b-b46f-4038-a984-eb172a628cc7",
:page 508,
:position {:bounding {:x1 163.42858123779297,
:y1 620.232177734375,
:x2 590.9100341796875,
:y2 642.5178833007812,
:width 806.3999999999999,
:height 1209.6},
:rects ({:x1 254.1785888671875,
:y1 620.232177734375,
:x2 590.9100341796875,
:y2 642.5178833007812,
:width 806.3999999999999,
:height 1209.6}
{:x1 163.42858123779297,
:y1 621.9732360839844,
:x2 253.81851196289062,
:y2 638.544677734375,
:width 806.3999999999999,
:height 1209.6}),
:page 508},
:content {:text "Figure 39.3: Processes Sharing An Open File Table Entry"},
:properties {:color "yellow"}}],
:extra {:page 507}}

View File

@ -342,7 +342,7 @@
;; ;use triple underscore `___` for slash `/` in page title
;; ;use Percent-encoding for other invalid characters
:file/name-format :triple-lowbar
:ui/show-brackets? false
:ui/show-brackets? true
;; specify the format of the filename for journal files
;; :journal/file-name-format "yyyy_MM_dd"

View File

@ -1165,3 +1165,44 @@ file-path:: ../assets/ostep_1681115599584_0.pdf
ls-type:: annotation
id:: 64382ab8-ad41-4c20-be74-3ce7446f20d6
hl-color:: green
- Files And Directories
ls-type:: annotation
hl-page:: 498
hl-color:: yellow
id:: 6438d8bf-19fd-4a4a-b491-3887c425aebf
- File Directory
- File: a linear array of bytes, each of which can be read or written
- Directory: a list of *(user-readable name, low-level name)* pairs
- directory tree, root directory, separator, sub-directories, absolute pathname
- inode number: low-level name of a file or directory
- Creating Files: system call `open` with `O_CREAT` flag
hl-page:: 500
ls-type:: annotation
id:: 6438dd4b-55ba-4649-90fd-7de69ed9c2ba
hl-color:: yellow
- file descriptor: an integer, ==private per process==, used to access files
hl-page:: 501
ls-type:: annotation
id:: 6438dd78-68fe-47c6-8ca6-b2de3206f4f1
hl-color:: yellow
- can be seen as a handle for file operations, or a pointer to an object of type file
- Reading And Writing Files: system call `read` and `write`
hl-page:: 502
ls-type:: annotation
id:: 6438e073-2636-4ec8-807d-3ecf83a5c0c0
hl-color:: yellow
- Non-sequential access: system call `lseek(fd, offset, whence)`
- explicit and implicit update to file offset
- open file table: represent all currently opened files in the system
- Shared File Table Entries
ls-type:: annotation
hl-page:: 506
hl-color:: yellow
id:: 6438e88b-e3e6-44a4-9f79-411c1f27ae71
- On every `open` call, the OS creates a new entry in the *open file table* even for the same file (same inode). Thus, they have independent offsets.
- Through `fork` or `dup`, we can make 2 file descriptors point to the same entry. In this case, reference count is needed to track when to release the entry.
- Figure 39.3: Processes Sharing An Open File Table Entry
ls-type:: annotation
hl-page:: 508
hl-color:: yellow
id:: 6438e98b-b46f-4038-a984-eb172a628cc7