Save
4Semester
BuS
Save
Share
Learn
Content
Leaderboard
Learn
Created by
Laso Liso
Visit profile
Cards (288)
Volatile memory
Requires power to maintain the stored information. If power is
lost
, the stored data is also
lost.
Volatile memory
RAM, CPU caches, etc.
Non-volatile memory
Retains
stored information
even without
power.
Non-volatile memory
hard drives (HDD), solid state drives (SSD), etc.
Volatile is
faster
than non-volatile
The
faster
the
memory
, the more expensive per byte
Memory hierarchy
Latency
,
Cost per byte
Memory types in order of increasing latency and decreasing cost per byte
CPU
registers
CPU
Caches
(
SRAM
)
Main
memory (
DRAM
)
Flash storage (
SSD
)
Magnetic storage (
HDD
)
Non-volatile memory (
NVRAM
)
Every device might work
differently
, we can't expose them directly to users + we need to provide
sharing
/isolation safely
The
OS
needs to show a clean interface of storage devices to user space
File
A logical unit of information stored on a disk in a persistent way. It has a
name
,
attributes
, and contains data.
File naming rules
Special
characters/spaces may or may not be allowed
Length:
8
characters in MS-DOS, usually
255
or more today
Case-sensitivity:
UNIX
file systems are usually case-sensitive, Windows file systems like
NTFS
are insensitive
Extension support: File names can be a
pair
<
name.extension
>, or just a name
File structure types
Unstructured
raw data
Record
based
Tree
From now on, we will only considered
unstructured raw data
, as this is what most
operating systems
use.
File types
Regular
files
Directories
Character
special files
Block
special files
ELF files
are a special type of regular file used for executables on
UNIX
systems
File attributes
Permissions
Password
Creator
Owner
Hidden
flag
Size
Creation
time
Last
modification
Last
access
File operations
Create
Delete
Get/Set
attributes
Rename
Open
Close
Read
/
Write
Seek
File descriptor
Represents an open file. Contains access mode,
position
,
file identifier.
UNIX
file descriptors 0, 1 and 2 have special meaning: standard input (
stdin
), output (stdout) and error (stderr) respectively.
Directories
store a list of files of any type, e.g., regular, directories, etc.
Directory topologies
Flat
Hierarchical
Path
Represents the "
address
" of a file in a
hierarchical
directory system. Can be absolute or relative.
Directory operations
Create
Delete
OpenDir
CloseDir
ReadDir
Hard link
An entry in a directory that
links
to an already existing file. A file can appear in
multiple
directories.
Symbolic link
A special type of file that contains a
reference
to another file or directory.
Get cwd:
pwd
Change cwd:
cd
<
new path
>
Special path characters
. =
cwd
.. =
parent
directory
e.g., ../../
bin
/
ls
Hidden
files
Directory Operations
Functions provided to users to
manipulate
directories
Create
Create an
empty
directory, with . and .. special files
Delete
Delete
a
directory
, only if it is empty
OpenDir
Open a directory before reading its content, returns a file
descriptor
CloseDir
Close a directory to free the file
descriptor
ReadDir
Read the
content
of the directory, i.e., the list of files it contains, in a
standardized
format
One last type of directory operations is heavily related to files:
links.
Hard Links
An entry in a directory that links to an already
existing file
Symbolic Links (symlinks)
A special file type that contains a
path
to another file
Link
Create a
hard
link
See all 288 cards