22+23 Flashcards

1
Q

What is a file?

A

A logical storage unit provided by the operating system. These are mapped onto secondary storage.

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

What attributes does a file have? Where is this stored?

A

File name, type, location size, protection, and housekeeping information. This is stored in an entry of a directory.

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

What is the open file table for?

A

If we want to operate on a file we have to search for it. To avoid this the system maintains an open file table.

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

What are the main system calls for file system? What do read and write involve?

A
Open, close, read, write. 
ssize_t write(int fd, const void *buf, size_t count): Write up to count bytes from buffer to the file reffered to by fd, returns number of bytes written successfully. On error returns -1 and errno set to errorcode.
ssize_t read(int fd, const void *buf, size_t count): like write, but reads instead.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a memory mapped file?

A

Opening file causes process’ virtual memory to be associated with thef ile, closing file writes memory mapped region back to disk.

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

How can we get the data in a file?

A

Sequential access: file pointer identifies record in file, can be moved incrementally forward or backwards. This is the most common method.
Direct access: File is a numbered sequence of records, operations can be carried out in any order on any record.

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

What is a directory?

A

A table of tuples, each has a pair of file name and file pointer. They can have sub directories. To refer to an arbitrary structure we need to specify a path from the root of the tree.

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

What does the file organisation module do?

A

Maps the logical system of files, directories, and partitions onto a storage device. To make this easier files are broken into logical blocks, making mapping to disk blocks easier.

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

What is contiguous allocation and linked allocation?

A

Contiguous: Each file occupies a set of contiguous blocks on disk, this is good for sequential and direct access. Though external fragmentation can be a problem, also files can grow.
Linked: Each file is linked list of data blocks, directory contains pointer to first and last blocks of file. This has no external fragmentation, and files can be as big as we want. Do note that this can only be used well for sequential access files, pointers take up space, internal fragmentation is an issue and if one pointer is lost so is the file from that point.

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

What is FAT and indexed allocation?

A

FAT: Table is created at beginning of each partition, with entry for each block in it. Directory entry for a file specifies the block number for first block of file. Value of the FAT entry for first block will identify block number for next block in file.
Same advantages as linked, but chaining is faster than linked list.
Disadvantages: Same as linked, more head seeks unless FAT is cached.
Indexed allocation: Each file has index block, containing table specifying physical block for each logical. Directory entry for a file contains address of its index block.
This has very direct access with no external fragmentation, but wastes space with internal fragmentation, need to allocate large array for index. Needs lots of head seeks.

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

What does inode do?

A

Linuxes index block(inode) combines direct indexing with multilevel indexing.

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

What are some of the basics about I/O devices?

A

I/O devices are linked to a machine via a port, typically this is a set of wires known as a bus, at each end of the link there’s a device controller

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

How does a CPU give commands to a device

A

The CPU specifies the device using the port’s address range, communication can be 1 byte at a time, or via direct memory access. The controller has a number of registers for holding signals which can be written to to control what happens.

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

What is handshaking for write command?

A

For each byte the be transferred:

  1. CPU reads busy bit until clear.
  2. CPU writes a byte to the data-out.
  3. CPU sets command-ready bit in a write command and writes command to control register.
  4. Controller reads control register since the command-ready bit is set. After it sees the write command, it immediately sets busy bit. Then reads data-out register and writes to device.
  5. Controller clears command-ready bit and then busy bit.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the interrupt priority levels?

How can we deal with this?

A

Errors: divide by zero, page fault
Device-generated interrupts.
Software interrupts.
Order of urgency is errors>device-generated interrupts.
We can deal with these seperately by using two interrupt lines, maskable:for device-generated interrupts and traps, can be disabled if something urgent happens, and nonmaskable: for signalling error messages,

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

What is direct memory access?

A

This uses a special purpose processor called the DMA controller. The CPU writes a DMA command block into memory and specifies which bytes should be transferred and where to put them. The DMA controller takes charge of moving data between the device memory and main memory. Once done it interrupts the CPU.

17
Q

What are device drivers? What do they map to?

A

Device drivers translate system calls into device-specific commands. They map one to one to device controllers.

18
Q

What are the main types of IO devices?

A

Character stream vs block
Sequential versus random access
Synchronous versus asynchronous
Sharable or dedicated.

19
Q

What are the main commands for a block device and a character device?

A

Block device requires: Read block, write block, seek block(for random-access block devices).
Character devices typically have a get character, put character commands, also typically support buffering and editing of buffers.

20
Q

What are blocking and nonblocking I/O system calls? How about asynchronous?

A

If a process issues a blocking I/O system call, it waits until the IO is complete. If a nonblocking IO is called it waits for fixed interval and returns.
If a process issues an asynchronous IO call the operation occurs in full but the process doesn’t wait for it.