cs 370 - midterm 1

0.0(0)
studied byStudied by 0 people
full-widthCall with Kai
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/72

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

73 Terms

1
New cards

polling interrupt system

the processor repeatedly checks each device

2
New cards

vectored interrupt system

device tells processor that they were the ones who interrupted
interrupting device provides the processor with a unique address that points to its service routine

3
New cards

interrupt handling

The mechanism by which the processor detects, saves the current state, services the interrupt through an interrupt service routine, and then resumes normal execution.

4
New cards

process

  • an executable stream (list of executables)

  • a running program

  • give each one an illusion its running alone and using CPU

  • each is allocated memory and loaded into main memory. The memory contains:

    • text section: program code

    • stack: temporary data, local variables

    • data section: global variables

    • heap: memory dynamically allocated

    • block starting symbol (BSS): uninitialized variables

5
New cards

program is static code/data and process is a dynamic instance of code/data

whats the difference between a program and process?

6
New cards

operating system

  • invested by General Motors Research Division for IBM mainfraims

  • resource manager of CPU, memory, disk, etc

  • A body of software the makes it easy to run programs, allow programs to share memory, and enabling programs to interact with devices

7
New cards

monolithic kernel

One of the structures of an operating system where everything is in the kernel (UNIX)

8
New cards

microkernel

One of the structures of an operating system where most of the OS code is in the user space (Mach, Amoeba)

9
New cards

MS-DOS

One of the structures of an operating system where its a simple, single-tasking, single-user disk operating system with no multitasking or protection

10
New cards

layered

One of the structures of an operating system where its divided into levels. Layer 0, the center, is the hardware and the highest level is the user interface

11
New cards

modular

One of the structures of an operating system where they implement loadable kernel modules. Each component (file systems, scheduling classes) is separate and loaded into kernel as needed

12
New cards

hybrid

One of the structures of an operating system that is not a pure model but combines multiple approaches

13
New cards

SYSGEN

the process of configuring and building an operating system so it is tailored to run on a specific computer system

14
New cards

Execution starts at a fixed memory location, and the initial boot code is stored in firmware ROM.

Where does execution begin when the system is powered on, and what holds the initial boot code?

15
New cards

A small piece of code, stored in ROM or EEPROM, that locates the kernel, loads it into memory, and starts it.

What is the boot loader, and where is it stored?

16
New cards

The ROM code loads a boot block, which then loads the boot loader from disk.

How does the two-step boot process usually work?

17
New cards

user mode (mode bit = 1) and kernel mode (mode bit = 0)

dual mode consists of what modes and what are their values?

18
New cards

system calls

services provided by the OS and accessed through APIs


a number is associated with each system call and system call interface maintains a table indexed according to these numbers

a type of trap

19
New cards

registers, block/table in memory and address of block

most system calls to pass parameters to the OS (from system calls) are through

20
New cards

blocked state

state of a process where it performed an operation that makes it not ready until some other event takes place

21
New cards

ready state

state of a process where the process is scheduled and ready to run

22
New cards

running state

state of a process where the process is running on a processor (CPU) (executing instructions)

23
New cards

processor control block (PCB)

where the processor contents and state of a process are stored (Process identifier (PID), process state, scheduling priority), especially useful when processes are being switched

separate for each process

24
New cards

trap

a type of interrupt that saves registers into main member, stack pointer, PC, in kernel space

25
New cards

build a new empty process from scratch or copy an existing process and change it appropriately

what are two ways to create a process?

26
New cards

fork()

where you create a new process (more specifically a copy of the process that called it

  • Both the parent and child continue execution from the point of the fork() call.

    In the parent process, fork() returns the PID of the child.

  • In the child process, fork() returns 0.

pid_t pid = fork();

if (pid == 0) {
    // This is the child process
} else {
    // This is the parent process
    // pid contains the child’s PID
}

27
New cards

exec()

when to run program that is different from calling program, essentially replaces the program that called it

does not return if it succeeds

28
New cards

wait()

a process wants to wait for a child process it made to complete to get its exit code and PID

29
New cards

exit()

when process reaches its end and asks the OS to delete it. 0 is successful and -1 is an issue

30
New cards

zombie state

when the program exited but has not been cleaned up/called wait from its parent process (its PCB is still there)

can be prevented by the parent process calling wait() to wait for its completion and tell OS to clean it up

31
New cards

abort()

when parent terminates executino of a child either because

  • child exceeded allocated resources

  • task to child is no longer required

  • parent is exiting and the OS doesn’t allow the child to continue if its parent terminates

32
New cards

orphan state

when parent process terminates without invoking wait while program is running

33
New cards

Static: code, global variables
dynamic: stack and heap

address space is the addresses the process has. Whats in an address space?

34
New cards

time sharing

one of the ways to run processes simultaneously by running a process, stopping, and running another by saving CPU registers to memory when process isn’t running

35
New cards

load its code/static data into memory, initializing the stack, do I/O work, and transfers control to CPU to process

how does OS get a program running?

36
New cards

space sharing 

one of the ways to run processes simultaneously by sharing memory across processes

37
New cards

memory management unit

part of processor that helps with address translation. Checks if its bounds. Adds base register to logical address to form physical address.

may also contain a segment table for each process in segmentation implementation

38
New cards

base register

smallest physical address

39
New cards

bounds register

size of this process’s virtual address space
OS kills process if it goes beyond this 

40
New cards

context switching

the operating system’s process of saving the state (like base and bounds registers) of the currently running process and loading the state of another process so the CPU can switch execution between them.

41
New cards

free partition

block of available memory

42
New cards

first fit

one of the ways to satisfy a request of size n from a list of free memory

find the first block that is big enough and return amount to user. Put back any space not used

43
New cards

best fit

one of the ways to satisfy a request of size n from a list of free
memory


search through the free list and find the smallest chunk that is as big/bigger than the requested size. Put leftover memory back.

produces smallest leftover free partitio

44
New cards

worst fit

one of the ways to satisfy a request of size n from a list of free
memory

Find the largest chunk and allocate the requested amount. Put the leftover on the freelist. 

performs badly and produces the largest leftover free partition

45
New cards

advantages of base & bounds registers

  • provides protection

  • supports dynamic relocation

  • simple 

  • fast

46
New cards

disadvantages of base & bounds registers

  • each process must be allocated contiguously

  • no partial sharing: cannot share limited parts of address space

47
New cards

external fragmentation

Have enough space in total but not contiguous space


physical memory comes full of little holes of free space, making it hard to allocate new segments

48
New cards

internal fragmentation 

Have a process where you have wasted space


allocated memory may be slightly larger than requested memory (a portion of the internal memory is not used)

49
New cards

segmentation

  • have a base/bound pair for each segment (code, stack, heap) of address space (instead of one pair)

advantages: enables sparse allocation of address space, different protection for different segments, enables sharing of segments, supports dynamic relocation for each segment 

disadvantages: segments must be allocated contiguously, internal fragmentation still an issue, external fragmentation may happen for large segments

<ul><li><p><span style="background-color: transparent;">have a base/bound pair for each segment (code, stack, heap) of address space (instead of one pair)</span></p></li></ul><p>advantages: enables sparse allocation of address space, different protection for different segments, enables sharing of segments, supports dynamic relocation for each segment&nbsp;<br></p><p>disadvantages: segments must be allocated contiguously, internal fragmentation still an issue, external fragmentation may happen for large segments</p>
50
New cards

top two

in segmentation, we use the ___ ___ bits from the logical address for segment

51
New cards

lowest bits

in segmentation, we use the ___ ___ bits from the logical address for offset within segment

52
New cards

paging

another way to virtualize memory by splitting address space into fixed sized units called a page and physical memory is also split into pages, called page frames

eliminates requirement that address space is contiguous

- still internal fragmentation but no external fragmentation
- page tables take a lot of memory
- doubled the time to translate addresses from virtual to physical because of page table lookups
- fast to allocate/free because no searching for suitable free space
- simple to swap memory to disk

<p>another way to virtualize memory by splitting address space into fixed sized units called a page and physical memory is also split into pages, called page frames<br><br>eliminates requirement that address space is contiguous<br><br>- still internal fragmentation but no external fragmentation<br>- page tables take a lot of memory<br>- doubled the time to translate addresses from virtual to physical because of page table lookups<br>- fast to allocate/free because no searching for suitable free space<br>- simple to swap memory to disk</p>
53
New cards

1,024 B

1 KB =

54
New cards

page table

maps virtual page number to physical page frame
- also contains valid (whether or not that page has been allocated by the process), protection, present, reference, and dirty bit

55
New cards

split it into a virtual page number and offset, replace virtual page number with physical frame number

to translate a virtual address with paging you do what?

56
New cards

offset

tells us which byte within page we want

57
New cards

log2(page size in bytes)

given known page size, how many bits are needed in address to specify offset in page?

58
New cards

210

how many bytes in a KB

59
New cards

220

how many bytes in a MB

60
New cards

2^(# bits for page number)

given the number of bits for page number, how do you calculate how many pages are there?

61
New cards

page table base register

points to the page table

62
New cards

page table length register

indicates size of the page table

63
New cards

2^12

how many bits is 4 KB?

64
New cards

translation lookaside buffer (TLB)

helps speed up address translation and minimize number of memory accesses per instruction by caching recently used page table entries.’'

has page number, page number, valid bit (whether entry has a valid translation in it), and other bits

don’t have to go to page table every single time

resides in CPU

usually improves performance for memory accesses with high spatial and temporal locality, not random memory accesses 

improve performance by:
- increasing page size (fewer unique page translations needed to access same amount of memory)

disadvantage:
- TLB increase cost of context switches

65
New cards

fully associative

what most TLBs are these days and simultaneously checks all of them at once through parallel; no hash function

66
New cards

number of TLB misses / number of TLB lookups

the equation for TLB miss rate

67
New cards

number of TLB hits / number of TLB lookups

the equation for TLB hit rate

68
New cards

1 + TLB miss rate

effective access time (EAT)

69
New cards

number of TLB entries * page size 

TLB Reach is how much memory you can access in TLB. how do you calculate it?

70
New cards

flush TLB on process switches, have an address space identifier (ASID) so processes can share TLB 

how to deal with multiple processes and TLB?

71
New cards

inverted page tables

only need entries for virtual pages with valid physical mappings 

physical page maps to corresponding page table

72
New cards

each segment has a page table

what happens when you combine paging + segmentation?

Disadvantage:
- potentially large page tables for each segment

73
New cards

multi-level page tables

a different structure for page tables that are not contiguous

  • page the page tables

  • if an entire page of page table entries is invalid, don’t allocate that page

  • creates multiple levels of page tables; outer level “page directory”

  • each page table fits in within a page