C+I Flashcards
(187 cards)
What is a file?
A file is a named collection of related information that is
recorded on secondary storage.
Attributes of a file (metadata)
Name of file identifier (chosen by system) location on storage device Size of file Protection mode of file (permissions) Create, access, modify times
Four file operations
CRUD Create Read Update Delete
Which of the for file operations isn’t technically required? Why?
Update
While inefficient, one could create a new, updated file for each edit and delete the old file
Directory
Storage of files (folder)
file organisation
File mounting
File system on a storage device may be mounted at a point in the existing file system
2 distinctive features of Linux file system
∙ an everything is a file approach;
∙ a tree-like file structure;
Everything is a file
All these things are classed as files ∙ regular files: sequences of bytes; ∙ directories: name/inode association lists; ∙ special files: peripheral devices; ∙ pipes: buffers between processes; ∙ links: locations of other files; ∙ symbolic links: names of other files.
Tree like file structure
Diagram with the BLK and 12 /256 stuff
Magnetic Disks - Organisation
Disk has a number of spring platters, over which hover some heads attached to a movable arm.
Platter divided into circular tracks, which are divided into sectors.
Tracks at one arm position make up a cylinder
Magnetic Disks - Operation
A magnetic disk is read/written by moving the arm to the required cylinder and using a head to sense/change the magnetism of a sector.
Solid-State Disks - Organisation
A solid-state disk has a controller, some buffer memory, and some flash memory.
Typically like 256Kb buffer memory, 128Mb flash memory with 4Kb pages and 256Kb block size, and ARM controller
Solid-State Disks - Reading
Copy a flash memory page to the buffer
Read data from page in buffer
Solid-State Disks - Writing
Copy a memory block into the buffer
Erase the block in the flash memory
Modify the block in the buffer
Write the block from the buffer to the flash memory.
Wear levelling (increase SSD lifetime)
Dynamic - writes new data to the least-recently-used block, cold data is not moved
Static - additionally periodically moves existing data to the least-recently used block, cold data is moved
3 categories of I/O devices
∙ human interface devices - e.g. screens or keyboards;
∙ storage devices - e.g. disks or tapes;
∙ transmission devices - e.g. network cards or modems.
Busses
An I/O device may be connected via a port (rare) or a bus (common).
e.g. Graphics, Bridge, Disk and Network controllers attached to the PCI bus
Controller registers of I/O devices
∙ the data-in register — data coming from device;
∙ the data-out register — data going to device;
∙ the status register — bits indicating status of device;
∙ the control register — bits giving commands to device.
Instructions used to access controller register
Standard memory instructions (common), or special instruction (rare)
2 approaches to I/O control
1) polling
2) interrupts
I/O control - polling
The processor checks the device to see if it is ready
“How you doing? How you doing? How you doing?”
WORSE
I/O control - interrupts
The device signals the processor when it is ready
BETTER
When is Direct Memory Access used?
When devices need to deal with large volumes of data
4 separate I/O system calls
1 character I/O
2 block I/O
3 memory-mapped I/O
4 network I/O