OS12 Flashcards

(23 cards)

1
Q

Describe the 3 zones of physical memory in Linux.

A

Zone DMA for DMA devices. Zone normal for kernel space. Zone highmem for user space.

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

State the purpose of the page allocator.

A

Allocates and frees all physical pages, can allocate ranges of physically-contiguous pages on request.

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

Describe the buddy-heap algorithm.

A

Each allocatable memory region is paired with an adjacent partner. Two free partners are combined into a larger region. If no small free region exists to satisfy a small memory request, subdivide a larger free region into two pieces to satisfy the request.

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

Describe the algorithm for allocating kernel memory.

A

The slab allocator - where freed memory is reused for objects of the same type.

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

How are virtual memory regions characterised?

A

By the backing store - from where the pages of a region come from. The region’s reaction to writes - e.g., page sharing or copy on write.

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

Describe what happens when a process runs a new program via exec.

A

An existing process is given a new, empty virtual address space. Program loading routines populate the address space with virtual-memory regions.

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

Describe what happens when a process creates a new process via fork.

A

New process is given a copy of the parent’s virtual address space, parent’s VMA and page tables. So initially, the parent and the child share the same physical pages of memory.

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

Describe the process of loading an ELF-format program.

A

An ELF-format program has a header and several page aligned sections. ELF loader reads header and maps sections of the file into various virtual memory regions.

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

How are devices and processes represented in the Linux filesystem?

A

Devices are represented by special files. The proc file system is computed on demand.

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

Describe the layout of an inode (index node).

A

Metadata of the file. Direct links to blocks of data. Single, double and triple indirect links to data blocks.

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

What is a directory in Linux?

A

It is itself an inode that maps filenames to inodes.

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

Define hardlink.

A

An instance of a file in a directory is a hardlink.

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

Define softlink.

A

It is a normal file containing a file name, interpreted by the file system.

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

Explain what a file descriptor is and how it can be mapped to an inode.

A

Each process sees files as file descriptors, which index into a process-specific open file table, which points to the system-wide open file table, which points to an inode in the inode table.

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

Explain what user IDs and group IDs are.

A

They are numeric identifiers to identify a single user/group.

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

Explain the access control rules for processes.

A

If process UID matches object UID, then process has user/owner rights. If process GID matches object GID, then process has group rights. Else process has world rights.

17
Q

Describe how access control information is held in each inode.

A

3 bits for r/w/x of owner, group and world.

18
Q

What do setuid and setgid bits do?

A

They allow processes to become someone else when running.

19
Q

State the purpose of a buffer cache.

A

Maintains copies of some parts of disk in memory for speed.

20
Q

Describe how reading a file through a buffer cache works.

A

Locate relevant blocks from inode. If not in buffer cache, read from disk into buffer cache. Return data from buffer cache.

21
Q

Describe the Linux boot process.

A

Kernel is loaded from disk and executed, mounting root filesystem. Reads /etc/inittab, for each entry creates a terminal special file (/dev/ttyX). For each tty, initializes the terminal and waits for login. Runs /bin/login on login, checks /etc/passwd to see if password matches; if match, starts the indicated shell.

22
Q

State the benefit of using CWD.

A

It avoids the need for fully qualified pathnames.

23
Q

Describe the 3 file descriptors that every process has opened by default.

A

stdin for reading input, stdout where output is sent, stderr where diagnostics are sent.