Files and Directories Flashcards

(73 cards)

1
Q

Secondary Storage Systems include _______ disks, ____, and tapes

A

magnetic, SSDs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Storing bits on ______ is different from storing them on flash

A

disk

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The OS provides a ______ view of storage to users

A

uniform

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The OS creates file _______ on storage media

A

systems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

File systems ________ store and retrieve data

A

efficiently

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

File systems enable ______ view of data via files and __________

A

logical, directories

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A file is a linear array of _____

A

bytes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Files persistently record user-defined information on ________

A

storage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the inode number?

A

The low-level name that internally identifies a file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are example of operation on files?

A
  • Open
  • Close
  • Read
  • Write
  • Reposition
  • Delete
  • Truncate
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

More complex operations on files can be made using ________ operations

A

primitive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In the POSIX file interface, what function do you use to create/open a file?

A

open(name, arg)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In the POSIX file interface, what does open() return?

A

A file descriptor used for accessing files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In the POSIX file interface, what do the arguments O_CREAT, O_WRONLY. and O_TRUNC do in open()?

A

O_CREAT - create new file
O_WRONLY - only write to the file
O_TRUNC - remove any existing content in the file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

In the POSIX file interface, how do you close a file?

A

close(file descriptor)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

In the POSIX file interface, how do you rename a file?

A

rename(char *old, char *new)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

In the POSIX file interface, how do you delete a file?

A

unlink(char *name)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

In the POSIX file interface, how do you read files?

A

read(file descriptor, buffer pointer, the size of the buffer)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

In the POSIX file interface, how do you write to files?

A

write(file descriptor, buffer pointer, the size of the buffer)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

In the POSIX file interface, what does read() return?

A

Number of bytes read

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

In the POSIX file interface, what does write() return?

A

Number of bytes written

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

In the POSIX file interface, you should repeat multiple _______ calls for larger files

A

write()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

In the POSIX file interface, each open file has a _______ offset

A

current

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

In the POSIX file interface, the current offset determines _____ the next read or write will begin from the file

A

where

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Current offset is also known as the ____ offset into the file
byte
26
In the POSIX file interface, read()/write() advances the current offset by the number of bytes _______/______
read/written
27
In the POSIX file interface, we can explicitly update the current offset using ______
lseek()
28
``` In the POSIX file interface, for the function off_t lseek(int fd, off_t offset, int whence); what do the 4 parts of the function do? ```
off_t: returns the resulting current offset fd: file descriptor offset: target position whence: how the seek is performed
29
In the POSIX file interface, for the function lseed(). what are the 3 valid whence values and what do they do?
- SEEK_SET: current offset = [offset] - SEEK_CUR: current offset += [offset] - SEEK_END: current offset = size of the file plus [offset] bytes
30
Storage and file systems ______ data
buffer
31
File system buffer data to improve __________
performance
32
In file systems, data written and read are __________ in memory
buffered
33
In file systems, data only _______ gets written from buffer to storage. We can ______ written data.
periodically, lose
34
The solution to losing data in the buffer is _______
fsync(int fd)
35
fsync() forces all ______ data to disk for the referred file
dirty
36
What is dirty data?
Data not yet written to disk
37
What does stat()/fstat() do?
Show the file metadata
38
Metadata refers to ___________ about data
information
39
Directories are logical _________ of files/directories
groupings
40
Directories also have an _____ number
inode
41
Directories list pairs of {user-readable ____, _____ number}
name, inode
42
What are some operations of directories?
- search for file - create file - delete file - rename file - list directory - traverse the file system
43
In the POSIX directory interface, how do you make a directory?
mkdir()
44
What 2 entries to empty directories have?
- .(itself) | - ..(parent)
45
In the POSIX directory interface, what does struct_dirent store?
Information about the directory
46
In the POSIX directory interface, we use _______ to delete a directory
rmdir()
47
When using rmdir(), we have to make sure that the directory is ______
empty
48
In the POSIX directory interface, what is the function for linking a new file name to an old one?
link(old pathname, new)
49
link() allows us to create another way to ______ to the same file
refer
50
In the POSIX directory interface, how is link implemented internally? (2 steps)
1. Create another name in the directory | 2. Refer it to the same inode number of the original file
51
In a ____ link, there is no difference between the new and old file
hard
52
A _______ _____ tracks how many different names have been linked to an inode
reference count
53
When unlink() is called, the reference count _________
decrements
54
A file is _____ deleted when the reference count reaches zero
truly
55
How can you find the reference count of a file?
stat()
56
Symlinks are more _______ than hard links
useful
57
Hard links cannot create to a _________ or to a file to another ___________
directory, partition
58
Inode numbers are only unique within a file ______
system
59
Symlinks are a _______ type the file system knows about
third
60
The symlink is a _____ by itself
file
61
The symlink holds the ____________ of the linked-to file as the data of the link file
pathname
62
In a symlink, a longer pathname makes a bigger ________ file
symlink
63
What is a dangling reference?
When the original file is removed and the symlink points to an invalid file
64
How do you create a file system?
mkfs()
65
mkfs() initializes an ______ file system, starting with a ______ __________ onto a disk partition
empty, root directory
66
mkfs() has two inputs: ________ and _____ ______- type
device, file system
67
_______ takes an existing directory as a target mount point
mount()
68
mount() _____ a new file system onto the directory tree at the mount point. The original files are ________ until ________
pastes, invisible, unmounted
69
A mount ______ shows what is mounted on a system
program
70
For mounting, ext4 refers to a ______ disk-based file system
standard
71
For mounting, ______ is a file system for accessing information about the current processes
proc
72
For mounting, ______ is a file system for temporary files
tmpfs
73
For mounting, AFS is a _________ file system
distributed