CSI 3131 Midterm

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/141

flashcard set

Earn XP

Description and Tags

Including modules 1, 2, 3, and 4

Last updated 2:41 AM on 6/23/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

142 Terms

1
New cards

what is a process

also known as a job, task, or user program, a process is a program in execution

2
New cards

what are the three responsibilities of an operating system

  • provide a simplified interface for hardware resources

  • manage the sharing of resources efficiently and equitably

  • control access to resources securely

3
New cards

what is preemption

when a process’s burst has been interrupted prematurely

4
New cards

what is the main hardware of an operating system

  • a processor (or several)

  • I/O modules, controllers, and processors

  • the main memory

  • interconnection between the above

5
New cards

what are the two parts of an operating system’s memory

main memory and secondary memory

6
New cards

what is the main memory of an operating system

this is limited, volatile memory directly accessible by the CPU, meaning processes must be loaded into the main memory to be able to be run by the CPU

7
New cards

what is the secondary memory of an operating system

often known as the disk, this is a large nonvolatile memory that is not directly accessible by the CPU. access to secondary memory is significantly slower

8
New cards

what are the three communication techniques for I/O devices in an operating system

  • direct I/O - without interrupts, requires the CPU to wait on the I/O request

  • I/O triggered by interrupts - I/O request runs concurrently to CPU but interrupts it once its operation has finished

  • direct memory access - I/O data is directly transferred to and from the memory without CPU interference, used most commonly today

9
New cards

what are the three types of processor-system architectures

  • single processor systems

  • multiprocessor systems

  • clusters or distributed systems

10
New cards

what are the functional differences between single processor systems and multiprocessor systems

multiprocessor systems have increased process throughput and reliability, but require more caution when developing due to increased scheduling complexity

11
New cards

what is a cluster or a distributed system

multiple machines sharing a disk but with their own memory and processors, running on one operating system. these are great for recovery from failure as another machine in the cluster can immediately take over if one fails

12
New cards

what is the kernel

the brain of the operating system, the kernel is the process that runs when nothing else is. the kernel provides a secure abstraction of hardware for other processes, and also decides when and how long a process can access that hardware

13
New cards

what are the three main functions of an operating system

  • controlling the execution of application programs, being able to safely relinquish and regain control of the system

  • be an interface between the user and hardware

  • error detection and reaction

14
New cards

what is a system program

an environment for program development. system programs tend to define how a user perceives their operating system

15
New cards

what are some of the services system programs offer

  • file management

  • system status information

  • file access and creation

  • editors

  • programming language support

  • program loading and execution

  • communications

  • application programs

16
New cards

what are some services the operating system offers

  • I/O operations

  • communications

  • error detection and reaction

  • resource allocation and management

  • accounting statistics and resources used

  • protection and security of resources

17
New cards

what is the command line interface

allows the user to interact with the operating system with commands from a shell. these commands either are executed by the command interpreter or are used to start a process

18
New cards

what is the graphic user interface

a higher level abstraction for users of all of the services offered by the operating system, including the system programs and application programs

19
New cards

what are the two modes an operating system can operate in

kernel mode and user mode

20
New cards

what is the purpose of the operating system having two modes

it allows the system to protect itself and components within it

21
New cards

what does kernel mode do

the kernel mode executes system calls and has access to operating system services

22
New cards

what does user mode do

user mode cannot access the operating system but can make system calls and run user programs

23
New cards

what are system calls

interfaces offering operating system services to user and application programs

24
New cards

what are some examples of system calls

  • process control (like starting a program)

  • file management (creation, viewing, writing, listing)

  • device management (request/release a device)

  • information management

  • communication

25
New cards

how are system calls implemented

with software interrupts. the user program invokes a trap instruction that interrupts the program, changes the bit mode to kernel, and calls the appropriate subroutine for the system call. calling programs aren’t aware of any implementation other than the call itself and the result of the call

26
New cards

what is an example of a system call

printf() makes a write() system call to the terminal

27
New cards

what are the main operations of an operating system

  • process management

  • memory management

  • secondary memory management

  • I/O abstraction subsystem, hiding the peculiarities of user devices

28
New cards

what do virtual machines do

they allow multiple operating systems to be on one machine by completely isolating all of the intricacies of each virtual machine from each other. each machine receives a percentage of the CPU, memory, and devices that are referred to as virtual resources

29
New cards

what are the two types of virtualization

  • type I virtualization, or hypervisors, where the virtualization software is integrated into the base operating system

  • type II virtualization, where the virtualization interface is on top of the base operating system

30
New cards

what resources are allocated to each process

an image of its program, data it will use, a heap, a stack, and a PCB

31
New cards

what is a PCB

a process control block. a PCB represents the current status of a process, and contains data to allow a process to resume execution properly. it contains the process state, the process id, the address of the next line in the program to run (the process counter), the states of the cpu registers when the process last executed, and a description table of open files

32
New cards

how are processes represented in READY queues

as a linked list of pointers to PCBs

33
New cards

what are the five main states of the lifecycle of a process

  • new

  • running

  • ready

  • waiting or blocked

  • terminated

34
New cards

when does the NEW→READY transition occur

when the long term scheduler chooses to process to be brought into the ready queue, at the same time loading it into the main memory

35
New cards

when does the READY→RUNNING transition occur

when the short term scheduler chooses the process from the ready queue to be executed by the CPU

36
New cards

when does the RUNNING→READY transition occur

when a process is interrupted by an event separate from other process, or when the process has been preempted, like having used up its time quantum

37
New cards

when does the RUNNING→WAITING transition occur

when the running process has been blocked because it has requested a service the operating system cannot offer yet, like a resource, an I/O result, or a response from another process

38
New cards

when does the WAITING→READY transition occur

when the operating system is finally able to offer the service that was blocking the process

39
New cards

when does the RUNNING→TERMINATED transition occur

when the process finishes its execution or is killed

40
New cards

what are the two extra process states in the process lifecycle

  • waiting suspended

  • ready suspended

41
New cards

why are there two extra process states

sometimes the medium term scheduler will need to free up the main memory by suspending some processes with the WAITING or READY state

42
New cards

what are the transitions like for WAITING SUSPENDED and READY SUSPENDED

the medium term scheduler prefers to suspend waiting processes and then ready queue processes if space is still needed. similarly, it prefers to reactivate processes in READY SUSPENDED first when there are no more active ready queue processes, but it may also reactivate WAITING SUSPENDED processes. suspended processes transition from waiting to ready as normal

43
New cards

what is context switching

the event of the CPU switching from executing one process to executing another. it will update and save the first process’s PCB, saving the program data as an image in either main or secondary memory and updating the PCB’s pointer to it, and then it will read the PCB from the next process and reset its registers, instruction counter, and many other resources to match what the new PCB describes

44
New cards

what does the speed of context switching rely on

the hardware of the system, as context switching is entirely overhead work

45
New cards

what is process scheduling

the selection of the next process to run by the short term scheduler, made to achieve good system usage and response time

46
New cards

is there just a queue for the CPU

no, all resources in an operating system have a waiting queue, but CPU queue is a focus because all processes must wait on the CPU

47
New cards

what are the three types of schedulers in an operating system

  • long term scheduler

  • medium term scheduler

  • short term scheduler

48
New cards

what is a short term scheduler

also known as the process scheduler, this scheduler selects which process in the CPU’s ready queue will execute next

49
New cards

what is the medium term scheduler

this scheduler selects which processes to suspend and reactive

50
New cards

what is the long term scheduler

also known as the job scheduler, this scheduler decides when a new process will be admitted into the ready queue, as well as when it will be loaded into the main memory. it also has the responsibility of controlling the degree of multiprogramming so that resources are efficiently used with the proper mix of I/O and CPU bound processes

51
New cards

what does it mean for a process to be I/O or CPU bound

it means that the process will spend more time either executing with the I/O modules or the CPU respectively, having more I/O or CPU bursts

52
New cards

how are processes created

by other processes, with a parent and child relationship

53
New cards

what does fork() do

it creates a child process that is a copy of the parent process, including the description table and the instruction counter, so the child process will start its execution at the next instruction after its creation. The child and the parent process do not share resources. Fork() also returns a value, which will be the process id of the child for the parent, and 0 for the child

54
New cards

what does wait() do

it makes a process wait to receive its child’s exit status, blocking the parent process until the child is done and properly ending the child process. it gives control over when related processes execute, otherwise the timing is entirely up to the scheduler

55
New cards

what does exec() do

it replaces the image within a process. a child might call exec() after being forked to run the program passed as a parameter

56
New cards

what does exit() do

it kills a process, taking 0 as the argument when the process exits without error and -1 when there is an error

57
New cards

what are the many ways a process might terminate

  • on exit()

  • upon encountering an error

  • another process calls kill(pid, signal) on it, usually the parent

58
New cards

what is a zombie process

a process that has terminated but its resources aren’t released. the resources of a process aren’t released until its exit status has been read, which can either be when the parent process calls wait() or the parent process terminates, in which case the init process will read the exit status instead

59
New cards

how might a parent process terminating before a child be handled

in unix, the children will be terminated too, but some other operating systems will adopt the children to other processes

60
New cards

what are cooperating processes

processes that can affect or be affected by other processes, having the advantage of information sharing which can speed up computation

61
New cards

what is IPC

interprocess communication, the mechanisms that alow process to communicate and synchronize

62
New cards

what are some examples of IPC mechanisms

  • signals

  • pipes

  • sockets

  • semaphores

63
New cards

what are the two models of IPC

shared memory and message passing

64
New cards

what is shared memory IPC

two processes share some space of memory. many precautions must be taken to protect the integrity of the shared data

65
New cards

what is message passing IPC

some processes with a communication link are able to perform the send(destination, msg) and receive(source, msg) operations with each other

66
New cards

what does the type of communication link determine

it determines in message passing how the send() and receive() operations function, how direct the communication is, how synchronized the processes are, and how the messages are buffered

67
New cards

what is a direct communication link

in direct communication, the source and destination are explicitly named, creating a link between two processes that can be uni- or bidirectional

68
New cards

what is an indirect communication link

in indirect communication, messages are sent and received from mailboxes or ports. each port has a unique ID and processes can only communicate if they share a port. in addition to send and receive, mailbox creation and destruction are also operations associated with it

69
New cards

how to resolve the issue of which process receives a message when more than two processes share a mailbox

there are a few solutions

  • allow the link to only be between two processes

  • only allow one process at a time to receive a message

  • notify the sender who received the message

70
New cards

what is a synchronous communication link

also known as blocked message passing, the sender will wait until the message is received, and the receiver will wait until the message is sent. sometimes this can be partial, where the sender can send multiple messages before being blocked. blocked message passing inherently synchronizes the sender and receiver, but also creates deadlocks if improperly implemented

71
New cards

what is a buffer in IPC

buffers store messages, and can block the sender if it becomes full, whether or not the link is synchronous, although synchronous direct links have no need for buffers

72
New cards

what is a description table

an arrray in the PCB that stores pointers to a process’s open files. innately, the description table is created with the first three positions being:

  1. standard input

  2. standard output

  3. standard error

73
New cards

what is a pipe

a unidirectional channel with a read end and a write end that allows related processes to communicate. each end of the pipe is considered an open file, and will be included in the description table of the process that created it. the messages in pipes move through in First In First Out order

74
New cards

what does pipe() do

pipe(int fd[2]) creates a pipe with fd[0] as its read end and fd[1] as its write end

75
New cards

what does read() do for pipes

read( fd[0], buff, n) reads n number of bytes from the read end of the pipe fd and copies those bytes into buff

76
New cards

what does write() do for pipes

write( fd[0], buff, n) writes n number of bytes from buff into the write end of the pipe fd

77
New cards

what does close() do for pipes

close(fd[x]) closes the x end of the pipe fd in the process’s description table so it can’t interact with that file anymore. closing the ends of a pipe that a process will no longer use protects the integrity of the pipe

78
New cards

what does dup2() do

dup2(fd1, fd2) copies the file descriptor at fd1 into the position of fd2. for printf() to write to a pipe’s write end instead of the standard output, use dup2(fd[1], 1)

79
New cards

what is a named pipe

a named pipe is a pipe that allows unrelated processes to communicate. they are created using the system call mkfifo() to create the pipe as a file, and then either opening that file to read or write as needed

80
New cards

what are sockets

a type of port communication that is considered an endpoint for communication. sockets are named in the convention IP_Address:Port and the communication link corresponds to a pair of sockets

81
New cards

what is remote call procedure

this communication allows multiple different computers to communicate, using a stub to hide communication details between the computers. RPC uses ports to identify servers

82
New cards

what is the role of a stub in RPC

a stub hides the details between the devices communicating, allowing different operating systems to communicate. for the client, the stub discovers the server and marshals the parameters into an external format. for servers, the stub receives the encoded message and extracts the parameters, executing the called procedure on the server

83
New cards

what is remote method invocation

a java communication mechanism similar to RPC, allowing a machine to invoke a method on a remote object

84
New cards

what are the two units of a process

  • the resource ownership unit, containing the image, the PCB, and resources the process uses

  • the execution unit or thread, containing the execution state and priority, the path of execution the process has taken, a small private memory space and a stack

85
New cards

what is a thread

a subdivision of a process that shares addressable space and resources with the other threads of the process, like variables and files. each thread is its own execution thread

86
New cards

what is multithreading

multithreading is when a process has more than one thread

87
New cards

how do threads of a process run together in multithreading

one thread of a process can run as long as the other threads are blocked, unless the system is a multiprocessor system, in which they can run concurrently

88
New cards

why use threads

creating, destroying, and switching between threads is cheaper than with processes because threads only have their state, stack, and space. additionally, thread intercommunication is cheaper because of their innately shared memory

89
New cards

what are the two types of threads

user threads and kernel threads

90
New cards

what are user threads

threads that aren’t visible by the kernel. this allows operations on these threads to not require system calls, however it also means that one blocked user thread blocks all the user threads on the same kernel thread and that those same user threads cannot run in parallel, ever

91
New cards

what are kernel threads

these are threads that are visible by the kernel, allowing it to individually perceive their execution states and run them in parallel, but requiring that operations on them must use system calls

92
New cards

what are the three types of relationships between kernel and user threads

  • one-to-one

  • one-to-many

  • many-to-many

93
New cards

describe the one-to-one kernel/user thread relation

there is one kernel thread for each user thread, which gives the user thread the same requirements as a kernel thread, but also the same benefits

94
New cards

describe the many-to-one kernel/user thread relation

there are several user threads for one kernel thread. the kernel cannot make a distinction between these user threads, resulting in the same drawbacks and benefits that user threads typically have

95
New cards

describe the many-to-many kernel/user thread relation

many user threads are assigned many kernel threads each, allowing for flexibility in execution. importantly, if one user thread blocks, its other kernel threads can be assigned to another user thread in that ‘knot’

96
New cards

how do fork() and exec() work with threads

forking might copy just the calling thread or all of the process’s threads, depending on the operating system, while exec replaces the program image for all of a process’s threads, because they all share the same image

97
New cards

what are the two types of thread termination

asynchronous cancellation and deferred cancellation

98
New cards

what is asynchronous cancellation of a thread

this ends a thread before it’s finished executing, potentially leaving resources unreleased and shared data in a bad state

99
New cards

what is deferred cancellation of a thread

this uses a flag that the thread will check to see if it needs to terminate, allowing it to end in a safe state

100
New cards

how to solve the issue of a process making an unknown number of threads for an unknown amount of tasks

thread pools, which create a group of threads all at once that will then wait to be assigned tasks. thread pools guarantee both the number of threads and when the creation of these threads will take place