cse3320 - operating systems (OS) final exam review

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/132

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 4:45 AM on 12/8/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

133 Terms

1
New cards

operating systems

a collection of software that manages computer resources and gives user an interface

2
New cards

interrupts

  • handled by the isr (interrupt service routine)

  • array of function pointers pointing to the interrupt vector

  • some small os systems use an event loop (status-driven system)

3
New cards

system calls

  • user generated

  • how we request to use resources

  • malloc, printf, fread/open/close

  • non-resource using functions are simple library calls

4
New cards

program

instructions written for a task

5
New cards

process

an instance of the program in execution

6
New cards

x86 ring protection

mechanism in x86 architecture to protect system resources (memory and I/O) from unauthorized access by less-privileged software.

just remember 0 is most privileged, ring 3 the least

7
New cards

how to switch from user to kernel?

  1. switch processor to kernel mode

  2. save and reload MMU (memory management unit) to switch to kernel address space

  3. save program counter and reload with the kernel entry point

8
New cards

how does an OS track a process?

pid - process ids, with the datatype being pid_t (int) and PCBs

9
New cards

what is a PCB

Process Control Block

  • one per process

  • contains all the info you’d need to know, 170+ fields

  • includes pointers to other structures like file and memory tables

  • held in a task_struct (array of pointers to pcbs)

10
New cards

why the term “task”?

tasks represent both processes and threads

11
New cards

monolithic kernels

  • used to one big blob loaded into memory

  • all functionality in one space

  • linux and ms-dos

12
New cards

what are the pros and cons of a monolithic kernel?

pros:

  • everything is in ring 0 so no need to switch

cons:

  • bloated

  • blue screen of death can take down OS

13
New cards

layered architecture

modules in one layer call functions provided in that layer

14
New cards

object oriented architecture

  • each OS module becomes an object and provides services

  • any object can invoke another object’s functions

15
New cards

microkernel

  • basic functionality in kernel (only code that needs priv. resources/instructions)

  • everything else runs in user space

  • less code in R0

  • easier to inspect for flaws because of a smaller codebase

  • could be slower as more interrupts will be called from user→kernel

Most OSes today are min-maxed to have as little code in the kernel and as much user functionality.

16
New cards

host (vm)

underlying hardware system

17
New cards

vmm / hypervisor

stands for virtual machine manager

creates and runs VMs by providing intrefaces identical to host

18
New cards

paravirtualization

guest OS modifed to work with the VMM

19
New cards

programming environment virtualization

VMM for virtual environments and not hardware (think .NET or the JVM for Java)

20
New cards

emulators

allow apps written for an environment to run on a different hardware license

21
New cards

vm benefits

  • isolated from host OS

  • freeze, suspend/resume, snapshot/resume, restore, clone

  • multiple OSes on a system

22
New cards

type 0 hypervisor

  • hardware-based, hypervisor supporting VM management and creation w/ firmware

  • IBM LPAR, Oracle LDOM

23
New cards

type 1 hypervisor

  • bare-metal hypervisor

  • runs directly on the hardware, eliminating the overhead of a host OS

  • VMware ESX, Citrix Xenserver, HyperV, KVM

24
New cards

type 2 hypervisor

  • apps built to run on OSes and provide VMM features to guest OSes

  • VMware Fusion and Workstation, Oracle Virtualbox

25
New cards

binary translation

when a VM OS wants to run a private instruction, the VMM tells the hypervisor to translate it into a non-privileged instruction.

26
New cards

process creation

  • process gets created by a parent process using fork()

  • init.d is the first process with no parent

  • almost everything is inherited from parent, excluding:

    • pid, parent pid, file locks, pending alarms, pending signals

27
New cards

what does fork return?

  • 0 in child process

  • pid in parent process

28
New cards

why might fork fail?

  • too many processes running

  • too many processing for the current user

29
New cards

how would you terminate a process?

  1. return from main function

  2. C library exit

  3. system can call _exit

    1. used when exec fails

30
New cards

what are some abnormal ways to terminate a process?

  1. abort signal

  2. any other abort

31
New cards

zombie process

a process that has completed execution but still lives in the process table

  • this is so the parent can read the child’s exit status

32
New cards

orphan process

a child process whose parent process has terminated before the child process has finished running

33
New cards

child processes will always?

  1. become zombies

  2. read by parent

  3. reaped by system

34
New cards

wait() and waitpid() do?

wakes up a process when the next child terminates.

child termination is asynchronous.

35
New cards

exec

Whenever exec is called, a new program specified by exec completely replaced the running process.

  • text, data, heap, and stack are all replaced

  • pid stays the same

36
New cards

exec family

exec(char const*file/path, *arg0/argv…)

options:

  • l - list of command line arguments provided

  • e - pointers to environment variables

  • p - path environment variable used to fine file

  • v - take in argv in array format

37
New cards

psuedo-parallelism

single CPU systems only run 1 process at a time, so processes are context swtiched between giving the illusion of parallelization.

multi-CPU systems have true parallelization and can run multiple processes at a time.

38
New cards

process model

  • all running software is organized with sequential processes

  • each process has a virtual CPU

  • true CPU is shared

    • multiprogramming is the switching back and forth between processes

39
New cards

context switch

act of switching CPU from one process to another.

  • context refers to the contents of the CPU register and program counter

40
New cards

steps to context switch?

  1. pause the process and store the context somewhere

  2. get and load the context of the next process

  3. go to the line of code defined by the program counter and resume process execution

41
New cards

process states

  1. running (using the CPU)

  2. ready (paused for other process)

  3. blocked (unable to run until external event happens)

42
New cards

CPU utilization formula

performance does not scale linearly.

say a process uses a fraction of the time p waiting for io; with n being the # of processes in memory, we can calc. CPU util with:

CPU Util = 1 - p^(n)

43
New cards

what are the types of scheduling?

  • cooperative multitasking

    • processes voluntarily give up CPU usage

  • pre-emptive multitasking

    • OS forcibly stops process and starts new one

44
New cards

what are the different types of scheduling systems?

  • batch

    • for large mainframes

    • non-preemptive or preemptive with long time quantum ok

  • interactive

    • preemptive for responsiveness

    • general purpose

  • real time

    • sometimes preemptive

45
New cards

what are the goals for all of scheduling?

  • policy enforcement: ensure it is carried out

  • balance: keep all parts of system busy

46
New cards

what are the goals for batch scheduling systems?

  • maximum throughput

  • turnaround time

  • maximum CPU utilization

47
New cards

what are the goals for real-time scheduling systems?

  • predictability

  • determinism

48
New cards

what are the goals for interactive scheduling systems?

  • responsiveness

  • meets user performance expectation

49
New cards

what are some scheduling metrics?

  • *throughput: jobs per unit of time

  • *turnaround time: time from arrival to completion

  • *response time: time from process submission to process run

  • wait time: time spent in queue

  • cpu utilization

* means it is skewable

50
New cards

fcfs

first-come-first-serve

51
New cards

shortest job next

  • based on runtime

  • shortest job is picked out of the ones currently available

52
New cards

turnaround time

sum of (time of finish - time of arrival) / n

53
New cards

response time

sum of (time start - time arrived) / n

54
New cards

shortest job next w/ preemption

  • same selection process as sjn

  • if process in waitqueue has a runtime less than the remaining current process’ runtime, we can jump in

55
New cards

priority

highest priority first

56
New cards

priority w/ preemption

same as priority except we can switch whenever a process with a higher priority enters the queue

57
New cards

address space

  • set of addresses in ram a process can use

  • more programs = more partitions for memory

  • segmentation faults can occur when you r/w to memory out-of-bounds

58
New cards

threads

in normal OSes, each process has an address space and 1 line of execution.

threads are multiple lines of execution and a share the address space.

59
New cards

what are some benefits of threads?

  • overlaps CPU work with I/O; say we have a long I/O wait in a program, threads allow us to run CPU-intensive work while waiting

  • more important tasks can be scheduled better

60
New cards

what is a user space thread?

  • OS does not need to be aware of it

  • can be implemented in any OS

  • doesn’t need to switch into the kernel

  • one blocking call makes all threads stop

  • one page fault also makes all threads stop

61
New cards

what is a kernel space thread

  • aware of all threads

  • switches kernel-user boundary a lot

62
New cards

race conditions

when 2 or more processes/threads are r/w shared data, and the output depends on who ran what and when.

63
New cards

critical regions

  • prevent race conditions from happening

  • part of the program where shared memory is accessed

  • example is a pthread mutex

64
New cards

mutex

  • pthread_mutex_lock

    • locks mutex variable. blocks other calling threads until the mutex is unlocked

  • pthread_mutex_trylock

    • tries to lock mutex. if it is already locked, return busy error code

  • pthread_mutex_unlock

    • unlocks mutex if owned by that thread. must call to unlock for other threads

    • error occurs if it is already unlocked or the calling thread is not the owner of the mutex

65
New cards

what are the 4 ways to avoid race conditions?

  1. no two processes can be in the same critical region together

  2. no assumptions can be made about speed or number of CPUs

  3. no prcess running outside the critical region can block processes

  4. no process should wait forever to enter the critical region

66
New cards

priority inversion and starvation

  • starvation and indefinite blocking

    • process is not deadlocked but not removed from the semaphore queue

  • priority inversion

    • lower-priority process holds lock needed by higher priority process

    • can be solved by a 2-priority system or by priority elevation to the owner of the resource

67
New cards

deadlocks

when 2 processes/threads become blocked waiting for a resource that the other one has

can happen in networks.

68
New cards

what are the types of resources?

  1. preemptable: can be taken away from a process w/ no ill effects

  2. non-preemptable: one that cannot be taken away w/o potentially causing failure

69
New cards

what are the conditions for a deadlock to occur?

  • mutual exclusion

    • each resource is currently assigned to one process or is available

  • hold-and-wait

    • processes holding resources that were granted earlier can request new resources

  • no preemption

    • previously granted resources cannot be taken away, and MUST be released by the process

  • circular wait

    • there must be a circular list of two or more processes, each of which is waiting for a resource held by the next member of the loop.

70
New cards

how can we deal w/ deadlocks?

  1. it goes away by itself

  2. detect and recover

  3. dynamic avoidance by careful resource allocation

  4. prevention

71
New cards

what are the 5 types of binding?

  • coding

  • compiler

  • link

  • load

  • run

72
New cards

what is binding?

binding is how the computer associates variables/functions/instructions to memory addresses.

73
New cards

relocation

when the compiler knows it has a func/var, but does not have enough info to figure out where to put it, it can leave a note in the relocation table for the linker to fill in the address later.

74
New cards

volatile storage

loses memory when power is taken away

75
New cards

nonvolative storage

keeps memory when power is taken away

76
New cards

memory manager

part of os that manages memory, tracking everything.

77
New cards

physical addresses

addresses used to refernce to physical memory

78
New cards

logical addresses

addresses the CPU generates as a program executes

79
New cards

how would you convert from a logical address to a physical one?

you need a base register, which denotes the “start” and “end” of where your process lives in memory.

logical + base register = physical

80
New cards

swapping

bringing an entire process into physical memory, run it for a bit, then send it back to the disk

81
New cards

internal fragmentation

there is unused memory in a fixed-size chunk

e.g. motorcycle in a car parking space; there is open space, but you cannot use it.

82
New cards

external fragmentation

there are available memory blocks but they are not contiguous (not touching one another)

e.g. bus looking for parking; if we combined open spaces, there would be space for a bus, but if they are scattered the bus will not fit

83
New cards

compaction

reorganizing fragmented space, expensive to do so

84
New cards

first fit

chooses the first block with a size >= the requested memory

a downside is that it tends to retread areas, meaning it will go back to the beginning every time to find the first available block.

85
New cards

next fit

first fit but the next request starts where the last allocation occured; this solves the retreading problem.

it goes back to the beginning if no space has been found.

86
New cards

best fit

searches heap end-to-end to find block closest in size to request with the least wasted space in the block.

87
New cards

worst fit

opposite of worst fit, meaning it finds the block with the most space.

worst fit is good at breaking down larger blocks.

88
New cards

what are the ways we can manage free memory?

  • bitmap

  • free list

89
New cards

bitmap

there is 1 bit per block on the disk.

  • 1 = in use

  • 0 = free

most space efficient over the long term, as it will always remain the same size.

90
New cards

free list

a linkedlist where each element points to the next open block.

better for determining contiguous blocks.

91
New cards

pages

divisions of the virtual address space into fixed size partitions

92
New cards

frames

divisions of the physical address space into fixed size partitions

93
New cards

page tables

used to translate virtual addresses into physical addresses.

every entry has these fields:

  • frame #: physical frame where this page resides

  • valid/invalid bit: if the page is in physical memory

  • r/w bit: is the bit r/w-able

  • executable: can we execute the code in that page

  • c/nc: cache/no cache

page 0 holds the offset of the ram (similar to base register from earlier)

94
New cards

parts of a virtual address

[ page number | offset ]

page #: what page the data is on

offset: where inside the page the data is

number of entries = 2^(page number)

size of page = 2 ^ (offset)

95
New cards

translation look aside buffer (tlb)

a cache where we keep frequently accessed pages.

  • holds the last n number of lookups we did in our page table

  • costs e (TLB lookup time), where e < M (time it takes to access memory normally w/o cache)

96
New cards

serial effective access time

serial does these steps in order:

[tlb lookup] → [use phys. addr.] → [memory access]

M = memory lookup time

e = TLB lookup time

a = % a hit is successful

2M = on lookup failure, you must go through page table → frame table, forcing you to do 2 memory lookups

serial EAT = (M + e)(a) + (2M + e)(1-a)

serial TLBs tend to be larger than parallel ones and therefore have better hit rates (a).

97
New cards

parallel effective access time

the difference between parallel and serial is that the TLB runs both the TLB lookup (e) and normal memory lookup at the same time (2M).

M = memory lookup time

e = TLB lookup time

a = % a hit is successful

2M = on lookup failure, you must go through page table → frame table, forcing you to do 2 memory lookups

parallel EAT = (M + e)(a) + (2M)(1-a)

parallel TLBs tend to be smaller to accomodate for the extra logic.

98
New cards

page fault

when a process tries to access a virtual addreess not loaded in physical memory

99
New cards

locality of reference

  • temporal locality

    • recently used data/instructions are likely to be used again soon

    • loop counters, stack vars, recent array elements

  • spatial locality

    • data near recently used addresses are likely to be used soon

    • sequential instructions, iterating through a loop

100
New cards

what does locality of reference have to do with page tables

locality is why paging works efficiently; it depends on locality.

storage in the page table often times means there will be fewer invalid lookups, meaning:

  • better TLB hitrate

  • fewer page faults

Explore top flashcards

flashcards
Week 1
20
Updated 716d ago
0.0(0)
flashcards
Introduction to Biology
33
Updated 446d ago
0.0(0)
flashcards
Classical Roots Lessons 7-8
42
Updated 1146d ago
0.0(0)
flashcards
Civil Rights and Liberties
38
Updated 1075d ago
0.0(0)
flashcards
units 1-7 vocab
361
Updated 1081d ago
0.0(0)
flashcards
Survey of Humanities- Boroque
40
Updated 925d ago
0.0(0)
flashcards
Week 1
20
Updated 716d ago
0.0(0)
flashcards
Introduction to Biology
33
Updated 446d ago
0.0(0)
flashcards
Classical Roots Lessons 7-8
42
Updated 1146d ago
0.0(0)
flashcards
Civil Rights and Liberties
38
Updated 1075d ago
0.0(0)
flashcards
units 1-7 vocab
361
Updated 1081d ago
0.0(0)
flashcards
Survey of Humanities- Boroque
40
Updated 925d ago
0.0(0)