Week 7 Flashcards

1
Q

Virtual Memory

A

We don’t need the whole program in all at once, code that is not in use (executing) isn’t loaded.

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

Pure Demand Paging

A
  • No pages are loaded into memory at the start of memory.
  • Every page must be brought in by a page fault, including first instr.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Demand Paging

A
  • Load in each page as needed.
  • Hardware needs to know which pages are in memory.
  • Invalid bit - if you access an invalid page it causes a page fault

GOOD ANSWER: A memory management technique where pages are only loaded into memory as needed

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

Backing Store

A
  • All frames are busy with other processes so we write our incoming process to the BACKING STORE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Memory Resident

A

Pages that are already in memory.
KEY IDEA: Not all pages for a process are assigned frames and are loaded into memory

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

Locality of Reference

A

If you’ve accessed one instruction in memory, the most likely to be executed next is the next spot in memory

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

.BSS segment

A

The other variation of exe. Contains uninitialized or zero initialized vars, and only specifies the size of the variables.

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

.Data segment

A

one variation of an exe. Contains initialized global variables, and constants to initialize local variables.

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

Fork()

A

Used to create a new process.
* = 0, execute code of child
* != 0, execute code of parent

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

Where does bash executable usually sit on a linux machine

A

/bin/bash
Accessed with #!/bin/bash

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

Copy On Write

A
  • Only copy a page when it’s modified.
  • Requires the MMU to decide which value to utilize.
  • Shared memory pages - when a process is copied, the OS doesn’t immediately duplicate memory pages. Instead, it shares them and marks them as read only, and when one of them needs to be accessed, it creates it’s own clone

GOOD ANSWER:
A technique used to optimize memory usage where copying the shared memory pages are deferred until needed

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

What does this do?
grep pthread main.c

A

prints the lines in main.c that contain the string pthread

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

What do these commands do?
ps - cat - cut

A

list process status
concatenates file to output
excract column from a file

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

What are all the types of wild cards and what do they do

A

” * : any sequence of zero or more characters
? : any single character
[xyz] x or y or z
[a-z] any chars from a - z

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

Difference between single quotes, double quotes and back quotes?

A

Single quotes evaluates the statement literally, EXCEPTIONS: Tools that use the argument to evaluate such as Grep, Awk, sed
Double quotes allow us to pass variables, delimited by $
Back quotes evaluates the expression, and then passes it. EX find (BACK QUOTE) pwd -name “*.txt” (BACK QUOTE)

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

How do you declare and access variables in bash?

A

$varName=value creates var if it doesnt exist
$varName=value2 now that it exists, sets it to value2

11
Q

Shell variables aren’t private to the shell T or F

A

F they are

12
Q

How do we declare environment variables?

A

export FOO=”bar”, now accessible to all sub processes.

13
Q

What are the special environment variables?

A

PATH - list of directions to find commands delimited by : EX “/usr/bin:/usr/local:.” searches /usr/bin and /usr/local
HOME - Current home dir
SHELL - current shell (/bin/bash/)
USER - username
PWD - current dir
SLLVL - number of nested shells

14
Q

What are two advantages of demand paging?

A

Space complexity, if we need to load less pages there’s less overall load
More efficient cpu cycles, quicker overall handling

15
Q

Does execv return out of itself thus rendering the rest of the code useless

A

Liz hella gay.

Yes

16
Q

The PCB Contains a copy of the stack T or F