Exam 2 Flashcards

1
Q

Interrupt

A

The type of exception that is generated by an I/O device. Example: I/O device completes request

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

Trap

A

The type of exception that occurs intentionally as a result of executing an instruction. Example: User program opens a file

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

Fault

A

If a process causes an access to data or instruction that is not currently in main memory. Example: Read of a instruction not currently in main memory

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

Abort

A

If a process causes an access to corrupted data or instructions. Example: Hardware error

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

Concurrent processing (Multitasking)

A

Single processor executes multiple processes concurrently. Register values for nonexecuting process saved in memory

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

Parallel processing (Multiprocessing)

A

Parallel processing is a type of concurrent processing where more than one set of instructions is executing simultaneously.

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

Logical control flow

A

Each program seems to have exclusive use of the CPU, provided by kernel mechanism called context switching.

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

Private virtual address space

A

Each program seems to have exclusive use of main memory. Provided by kernel mechanism called virtual memory

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

User vs. Kernel mode

A

In User mode, the executing code has no ability to directly access hardware or reference memory.

In Kernel mode, the executing code has complete and unrestricted access to the underlying hardware.

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

Context Switch

A

Processes are managed by a shared chunk of memory resident OS code called the kernel. Important: the kernel is not a separate process, but rather runs as part of some existing process. Control flow passes from one process to another via a context switch

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

zombie

A

When process terminates, it still consumes system resources. Examples: Exit status, various OS tables. Called a “zombie”. Living corpse, half alive and half dead

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

Signal

A

A small message that notifies a process that an event of some type has occurred in the system

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

Pending Signal

A

A signal that has been sent but not received yet; there can be at most one pending sending of a particular type. Any more are discarded

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

Blocked Signal

A

When a signal is blocked, it can be delivered, but the resulting pending signal will not be received until the process unblocks the signal.

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

Sending Signals

A

Every way to send a signal relies on the idea of a process group. Every process belongs to exactly one group, obtained by the getpgrp function. Setpgid can change process ID

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

Receiving Signals

A

When the kernel switches a process to user mode, it checks the set of unblocked pending signals, and if there are none, it passes control to the next instruction. If there are pending signals, it forces the process to receive the signal

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

Catching Signals

A

Signals have default actions that can be overridden with signal handlers

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

sigprocmask, sigfillset, sigemptyset, sigaddset, sigdelset

A

sigprocmask - Changes the set of currently blocked signals

sigfillset - initializes a signal set to contain all signals

sigemptyset - initialize a signal set to contain NO signals

sigaddset - add a signal s to a set S via sigaddset, S=S∪{s}

sigdelset - remove a signal s from a set via sigdelset, S=S{s}

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

alarm

A

A function that sends the SIGALRM signal

Arranges for the kernel to send a SIGALRM signal to the calling process in (secs) seconds.

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

atexit

A

Executed every time an application is about to shut down

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

getpid

A

Returns the process ID of the calling process. This is often used by routines that generate unique temporary filenames.

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

getppid

A

Returns the process ID of the parent of the calling process. If the calling process was created by the fork() function and the parent process still exists at the time of the getppid function call, this function returns the process ID of the parent process. Otherwise, this function returns a value of 1 which is the process id for init process.

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

getpgrp, setpgid

A

getpgrp - Returns the group ID the process belongs to

setgpid - Sets the group ID of the process

24
Q

getpgrp, setpgid

A

getpgrp - Returns the group ID the process belongs to

setgpid - Sets the group ID of the process

25
Q

setjmp

A

Saves the current calling environment in the env buffer and returns 0. The calling environment includes the program counter, stack pointer, and GP regs.

26
Q

longjmp

A

Restores the calling environment from the env buffer and then triggers a return from the most recent setjmp call that initialized env.

Setjmp now returns with the nonzero return value retval

27
Q

Benefits of VM

A

PAGE 812

o Efficiency of main memory usage
o Simplify memory management
o Memory protection: isolate address spaces (avoid process interference)
o Simplify Linking and Loading

28
Q

Hardware/Software cost of VM

A

o Address translation
o Page tables (must also be accessed in DRAM cache)
o Translation (both hardware and software if page fault)

29
Q

Working set

A

Set of active pages since total pagesize might exceed size of physical memory

30
Q

Swap file

A

a space on a hard disk used as the virtual memory extension of a computer’s real memory

31
Q

Thrasing

A

When pages are swapped in and out of the working set continuously

32
Q

TLB (Translation Lookaside Buffer)

A

A small cache of page table entries located in the MMU. Purpose is to decrease cycles required for translating virtual addresses into physical ones

33
Q

DRAM cache organization driven by cost of misses, therefore:

A

§ large block size
§ write-back (rather than write-through)
§ fully-associative (any memory page can load into any page frame)
§ Complex replacement algorithms—must implement in software

34
Q

How does TLB view a virtual address?

A

§ VPO – virtual page offset is same as PPO—physical page offset
§ TLBI – TLB index (selects TLB set)
§ TLBT – TLB tag (compare with tags in set)

35
Q

Page Table Entry

A

An entry in the page table mapping a virtual address space to a fixed offset

36
Q

PTE Content

A

Contains a valid bit and an n-bit address field

37
Q

How does TLB view a virtual address?

A

§ VPO – virtual page offset is same as PPO—physical page offset
§ TLBI – TLB index (selects TLB set)
§ TLBT – TLB tag (compare with tags in set)

38
Q

Program Loading with VM

A

o VM areas are initialized by associating them with disk objects—memory mapping
§ task_struct -> mm_struct -> list of vm_area_struct
§ what is pgd used for?
§ VM areas allows VM to be non-contiguous.
§ segmentation fault is caused by an address access outside any VM area
§ protection fault is caused by access to a valid area but without valid permissions.

39
Q

pgd

A

the page global directory (pgd) which consists of an array of pgd_t types. The entries in the pgd point to entries in the second level directory, the PMD. The second-level page table is the page middle directory (PMD), which is an array of pmd_t types. Entries in the PMD point to entries in the PTE. Final level = page table; consists of page table entries of type pte_t. Page table entries point to physical pages

40
Q

task_struct

A
  • The OS stores process state in a data structure called process control block. There is one per process
    called task_struct in linux
41
Q

mm_struct

A

kernel’s representation of a process’s address space
important fields:
-mm_users = # of processes using the address space
-mm_count = main reference count; when the kernel operates on an address space, it bumps up the reference counter. all users = 1 count
-mmap and mm_rb: contain all the memory areas in this address space
pgd_t *pgd: physical address of the first thing in the pgd??? do we add the PGD offset to the start address of the PGD?

all of the mm_struct structures of every process are strung together in a doubly linked list via the mmlist field

42
Q

vm_area_struct

A

describes a single memory area over a CONTIGUOUS VIRTUAL ADDRESS INTERVAL in a given address space
each VMA possesses certain permissions and associated operations
each VMA structure can represent different types of memory areas

important struct fields:
-VMA start (lowest address in the interval)
-vm_end (first byte AFTER the highest address in the interval)
length in bytes of memory area = vm_end - vm_start

43
Q

An area can be backed by

A

§ regular file
o Initial page byte come from section of disk file
§ anonymous file (e.g. nothing)
o First fault allocates a page full of zeroes called a demand-zero page
o When a page is written to (becomes dirty), like any other page
o Dirty pages are swapped back and forth between memory and a special file called the swap file

44
Q

mmap

A
  • allows you to comb through a file like it is an array. Asks the kernel to create a new virtual memory area
45
Q

private copy-on-write

A

As soon as a process attempts to write to some page in the private area, a write will trigger a protection fault, and the fault handler creates a new copy of the page in physical memory, and restores write permissions.

46
Q

shared object

A

Any writes that the process makes to the area are visible to any other processes that have also mapped the shared object into their virtual memory

47
Q

private object

A

Changes not visible to other processes, and any writes that the process makes to the area are not reflected back to the object on disk

48
Q

Why dynamic memory allocation? When is this needed?

A

More portable, often we don’t know the size of certain data structures until the program runs.

49
Q

Explicit vs. implicit allocators

A

Explicit - Requires the application to explicitly free any allocated blocks, for example, the free() function in CC

Implicit - Require the allocator to detect when an allocated block is no longer being used, and then free the block. AKA, garbage collectors

50
Q

Requirements for explicit allocators

A
Handling arbitrary request sequences
Making immediate responses to requests
Using only the heap
Aligning blocks
Not modifying allocated blocks
51
Q

Allocator throughput

A

Number of requests that it completes per unit of time

52
Q

Peak memory utilization

A

How efficiently an allocator uses the heap

53
Q

Aggregate payload

A

The sum of the payloads of the currently allocated blocks

54
Q

Internal fragmentation

A

Occurs when an allocated block is larger than the payload

55
Q

External fragmentation

A

Occurs when there is enough aggregate free memory to satisfy an allocate request, but no single free block is large enough to handle the request

56
Q

Block format

A

Header, payload, padding.

Header encodes the block size as well as whether the block is allocated or free

Payload - Follows the header and is what the application actually requested

57
Q

Segregated Free Lists

A

Each array contains blocks of the same size or class size (i.e. power of two).