cs 230

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

1/111

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 12:10 AM on 9/3/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

112 Terms

1
New cards

in vm, are pages not in physical memory considered unallocated

no, allocated pages can be stored on disk as uncached pages

2
New cards

virtual memory organization

N contiguous bytes (virtual memory page size)

3
New cards

physical memory page size

P contiguous bytes (physical memory page size)

4
New cards

what do modern general purpose computers use to access data in memory

they use virtual addressing, mmu helps translate between physical and virtual addresses

5
New cards

virtual memory definition

interaction of hardware exceptions, hardware address translation, main memory, disk files, and kernel

6
New cards

virtual memory capabilities

  • uses main memory as a cache

  • provides large uniform address space

  • protects process address space


7
New cards

what happens when a page fault occurs

OS kernel executes page swapping or page allocation

8
New cards

what does page table entry consist of

valid bit and n-bit address field

9
New cards

what does a page table map

it maps virtual addresses to physical addresses

10
New cards

if a page table maps to physical addresses, where may these physical addresses be

  • main memory

  • in the disk


11
New cards

what does valid bit in a PTE indicate

that the virtual page is RAM (physical memory)

12
New cards

VM operations when there is a “hit” in physical memory

  • processor generates VA and sends to MMU

  • MMU generates PTE address and requests it from the cache/main memory

  • cache/main memory returns PTE to the MMU

  • MMU constructs the PA and sends it to cache/main memory

  • cache/main memory returns the requested data to the processor


13
New cards

VM operations when there is a “miss” in physical memory

  • processor generates VA and sends to MMU

  • MMU generates the PTE address and requests it from cache/main memory

  • cache/main memory returns the PTE to the MMU

  • valid bit is 0, triggers exception, CPU transfers control to fault handler

  • fault handler pages in new page and updates PTE in memory

  • Fault handler returns to process and restarts offending instruction


14
New cards

interrupt

signal from i/o device, returns to next instruction

(recoverable)

15
New cards

trap

system call, returns to next instruction (recoverable)

16
New cards

fault

page fault, re-executes current instruction
(potentially recoverable)

17
New cards

abort

divide by 0, (non-recoverable)

18
New cards

hardware level

signal from i/o device

19
New cards

operating system

context switch between processes

20
New cards

user

processes can send signals to other processes (ctrl-z from command line)

21
New cards

system call to return process ID of the parent process of the process executing the call

getppid()

22
New cards

what is status code passes to exit system call anded with octal value 0377

to support 16 bit systems

23
New cards

process

combination of machine state and memory state managed by the OS in an internal data structure

24
New cards

what state is a process in if it’s currently waiting to be executed on the CPU

running state

25
New cards

what happens to the relationships when processes are created and terminated

the OS maintains relationship between parent and child in a tree data structure

26
New cards

if a “fork” system call is successful what happens

called once returns twice

27
New cards

how many times must wait() system call be used to reap x children

it must be called x times

28
New cards

how many zombie child processes can P have if there is one running child process when P is terminated

N-1

29
New cards

if a execve system call is successful what happens

it’s called once and it never returns

30
New cards

what system calls are most important to write a shell like bash

fork and execve

31
New cards

what should a process do to block an incoming signal

set the corresponding signal bit in the signal mask associated with the process

32
New cards

0 means

read end

33
New cards

1 means

write end

34
New cards

what happens if a pipe is full and the process wants to write more data

the pipe blocks the write until more space opens up in the buffer

35
New cards

what happens if we don’t close the read file descriptor of the writing process

the writing process will never receive SIGPIPE signal even though the reading process has terminated

36
New cards

IPC

inter-process communication

37
New cards

if a process makes an illegal memory reference what does the operating system send

a sigsegv signal

38
New cards

what should child 1 and child 2 do if child 1 wants to send messages to child 2 using a pipe

child 1 should close its read file descriptor, and child 2 should close its write file descriptor

39
New cards

pending signal set/vector bit

tells you if signal have occurred at least once
* does not tell you how many times a signal has occurred

40
New cards

what happens if you read from a pipe or FIFO file without any processes writing to them

read returns end of file

41
New cards

process properties

  • represents an entire program

  • high overhead

  • coarse-grained parallelism


42
New cards

high overhead

occurs if creating and destroying processes, context switching, synchronizing, and communication costs are very high

43
New cards

coarse grained parallelism

each parallel task does a lot of independent work before communicating to other processes

44
New cards

thread properties

  • allocated within a process

  • sequence of instructions

  • lower overhead

  • represent small chunks of code (like functions)

  • fine grained parallelism


45
New cards

allocated within a process

threads are created within an existing process, thread cannot exist without a process

46
New cards

fine grained parallelism

  • each parallel task does a small amount of work before synchronization

  • smaller tasks with more coordination between threads


47
New cards

what is void *arg used for

passed as an argument to thread function start

48
New cards

how are threads and processes different

differ in sharing code and data/memory


processes: when fork is used, even though address space is copied, after that those properties become individual for both parent and child, so if there is a change to a global var by the parent, that doesn’t affect the child


threads read/write from the same memory address as long the threads exist

49
New cards

what happens after a thread calls pthread_create?

it resumes execution with the next statement after the call to pthread_create

50
New cards

what should a thread use to reap itself using pthread_detach

should call pthread_detach with its own thread ID retrieved by pthread_self()

51
New cards

if a thread exits what happens

it becomes a zombie thread until a peer thread calls pthread_join()

52
New cards

global variable

memory contains exactly one instance of these declared outside of a function

53
New cards

local variable

each thread stack has one instance of each local variable, for each time the function is being executed by that thread

54
New cards

local static variable

memory contains exactly one instance of these that are declared inside of a function

55
New cards

race condition

two or more threads access shared data and try changing it at the same time, don’t know which order the threads will attempt to access the shared data

56
New cards

sem_wait

decrements counter by 1, if ctr is already 0 then thread sleeps until another thread calls sem_post

57
New cards

sem_post

increment counter by 1, returns immediately

58
New cards

semaphore

synchronizes thread operations on share data to prevent race conditions

59
New cards

mutex

binary value used to ensure exclusive access to share data

60
New cards

execution status

tuple of the current instructions of each thread in a process

61
New cards

critical section

section of code w/ race condition

62
New cards

unsafe region

region in progress graph where 2+ states within are inside a critical section

63
New cards

progress graph

execution state space

64
New cards

trajectory

series of valid execution state transitions

65
New cards

what method is used to terminate a thread

pthread_exit()

66
New cards

internet protocol stack (top to bottom) w/ FTP, WIFI, IP, TCP

FTP → TCP → IP → WIFI

67
New cards

Domain Name System properties

  • distributed database implemented in a hierarchy of many name servers

  • takes a domain name, produces an IP address

  • takes an IP address and produces a domain name

  • value of struct hostent has IP address and hostname


68
New cards

IPv4 address

127.0.0.1

69
New cards

port 80

web server

70
New cards

port 21

FTP server

71
New cards

port 22

SSH

72
New cards

well-known ports

ports 0 through 1023

73
New cards

order of function calls for TCP/IP server listening for connections

socket(), bind(), listen(), accept(), send/recieve/read/write(), close()

74
New cards

order of function calls for TCP/IP client listening for connections

socket(), connect(), send/recieve/read/write(), close()

75
New cards

role of server vs role of client in establishing TCP connection

passive vs active

76
New cards

TCP vs UDP

TCP: provides reliable transport between sending/receiving process (like a conversation), used for client server model

UDP: provides faster data transfer but no retransmission, used for streaming servers/fast paced games

77
New cards

internet definition (nuts and bolts)

  • collection of billions of computing devices, and packet switches interconnected by links

  • a network of networks


78
New cards

protocol

the client server model, a conversation

79
New cards

application layer

supporting network applications

80
New cards

transport layer

transfer of data between one process and another process (usually on diff hosts)

81
New cards

network layer

delivery of datagrams from a source host to a dest host

82
New cards

link layer

transfer of data between neighboring network devices

83
New cards

physical layer

transfer of a bit into and out of a transmission media

84
New cards

encapsulation

taking data from layer above, adding header fields appropriate to layer, placing data in payload field of packet for that layer

85
New cards

protocol stack with HTTP, IP, Ethernet, TCP (top to bottom)

HTTP → TCP → IP → Ethernet

86
New cards

accept()

  • blocking call that creates new socket with same type, address family, protocol as specified socket

  • allocates a new file descriptor for created socket

  • prevents caller from doing anything until blocking function returns control to it


87
New cards

size of IPv4 address

32 bits

88
New cards

sisze of IPv6 address

128 bits

89
New cards

SOCK_STREAM

reliable, 2-way, connection based, TCP

90
New cards

SOCK_DGRAM

unreliable, connectionless, UDP

91
New cards

fixed machines

used for specific purpose, cannot be reprogrammed for a different task just by programming, need re-design and re-wiring

92
New cards

general purpose machines

can change tasks with programmability, programs are stored in memory

93
New cards

ISA

Instruction set architecture, instruction API to a machine

94
New cards

instruction register

stores current instruction

95
New cards

instruction counter

stores address of next instruction, incremented automatically by machine

96
New cards

status register

stores info about result of last operation

97
New cards

signal generator

communicates w/ rest of the processor

98
New cards

decoder

reads the instruction and determines what signals to generate

99
New cards

execution unit

processor core

100
New cards

arithmetic logic unit (ALU)

performs calculations