OS Processes and Memory Review

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/25

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.

26 Terms

1
New cards

context switching; savings, loading, updating data

What does an OS do when it switches processes?

2
New cards

Running

Ready Blocked

What are the states and state transitions for a process, and can you draw a diagram depicting them?

3
New cards

kernel mode - privledged

user mode - unprivledged

What are the two processor modes of an OS that we discussed?

4
New cards

Switching from Kernel to User, vice verse:

A trap instruction is executed that jumps to the kernel and raises the processor mode.
A return-from-trap instruction lowers the processor mode and jumps back to the calling code in the application.

How does an OS switch between processor modes?

5
New cards

fork(): Creates a new child process as an exact copy of the parent.

exec(): Replaces the current process image with a new program.

What is fork()? What is exec()? What’s the difference?

6
New cards

Interrupt timer - interrupt the processor, forcing it to give
control back to the OS

Interrupt handler - executed when interrupt is triggered, yielding control back to OS

How does the OS switch processes?

7
New cards

Turnaround Time = Completion Time − Arrival Time

What is turnaround time?

8
New cards

Ensures no process is starved, getting a fair share of CPU time

What is fairness?

9
New cards

FIFO - If a long job arrives first, all shorter jobs must wait

SJF - A long job may never execute if short jobs keep arriving

Can you give examples that make FIFO and SJF unideal?

10
New cards
<p><span><strong>overlapping I/O and CPU execution</strong></span></p><p></p>

overlapping I/O and CPU execution

What is overlap in terms of job scheduling?

11
New cards

Lottery scheduling assigns random tickets to processes, and a ticket is drawn randomly to decide execution.

Issue: It lacks deterministic guarantees; a process might get unlucky and starve.

Can you describe a lottery scheduler, and can you identify where it might falter?

12
New cards

Isolation (processes don’t interfere)

Security (no direct memory access)

Efficient memory management

Why do we virtualize memory?

13
New cards

ease of use

isolation

protection

What are the goals of memory virtualization, and why are they important?

14
New cards

The range of memory addresses a process can use.

What is an address space?

15
New cards

Code: Program instructions 00

Stack: Function calls and local variables 11

Heap: Dynamically allocated memory 01

What are the three main memory components of a running process?

16
New cards
  1. We want to implement virtualizing memory in a transparent way.
    • Invisible to running programs.

  2. We want the system to be as efficient as possible.
    • Don’t slow the programs down.
    • Don’t use up more memory than necessary (data structures).

  3. We want to protect processes from one another.
    • Also want to protect the OS

What are the goals of memory abstraction, and why are they important?

17
New cards

Stack: Managed automatically, grows downward, used for function calls and local variables.

Heap: Dynamically allocated memory, grows upward, managed manually.

What is different (functionally) between a stack and a heap?

18
New cards

conversion of virtual into physical addresses

What is address translation?

19
New cards

Utilization of a base and bounds system.


In this system, there are two hardware registers, one called the base register and another called the bounds register. Every program is written and compiled as if to be loaded at address 0x0. The OS sets the base register to where it wants the process to be in
physical memory. The processor then translates:


physical = virtual + base

How does the early incarnation of dynamic relocation for address translation work?

20
New cards

Uses interrupts and system calls to transition from user mode to kernel mode.

How does an OS switch between processor modes?

21
New cards

A register that stores the upper memory limit for a process to prevent it from accessing out-of-bounds memory.

What is the bounds register?

22
New cards

Unused memory inside an allocated block due to fixed-size allocation

What is internal fragmentation?

23
New cards

Divides memory into logical segments, using a base bounds register of address space (code, stack, heap)

What is segmentation, and why did we implement it?

24
New cards

Explicit - which system an address refers too - top two bits refer to the segment, the rest offset. 00 code, 01 heap, stack 11.

Implicit - how the address was formed - instruction ptr → code, stack ptr → stack, any other is heap

What are the two approaches to address translation for segmentation?

25
New cards

Shared page mappings

What do we need to share certain memory segments between address spaces?

26
New cards

Wasted memory between allocated blocks due to variable-sized allocation.

What is external fragmentation?