ENSF 461 MIDTERM EXAM QUESTIONS AND
ANSWERS 2025
What is an OS - ...ANSWER... ✔ ✔Acts as an
intermediary between the computer user and computer
hardware
What does the OS do - ...ANSWER... ✔ ✔3 main
things:
1. Virtualize resources (like CPU and memory) - so that
every machine can have the illusion of a dedicated
machine
2. Manage I/O - so that multiple processes can access
I/O devices concurrently without interfering
3. Make the above two easy
Separation - ...ANSWER... ✔ ✔- the idea is to give
the CPU 2 modes of execution of a program:
1. Unprivileged Mode/User Mode - for regular
processes -> program does not have direct access to the
memory and hardware
,2|Page
2. Privileged Mode/Kernel Mode - for OS code ->
program has direct access to the memory and
hardware.
One problem with kernel mode: If the program crashes,
the entire system will crash. But if a program is
executing in user mode and the program crashes, the
entire system will not crash.
- program switches to kernel mode using system calls
- CPU defines a trap, an instruction to jump to OS code
and back
System Call - ...ANSWER... ✔ ✔- when a program
requests a service/resource from the OS
- Programs usually run in user mode. When the program
needs to access OS resources (memory, hardware, etc.),
it makes a SYSTEM CALL, requesting those resources.
- when that system call is made, the program switches
from user mode to kernel mode so that the program can
use those resources
Multiprogramming - ...ANSWER... ✔ ✔- if you only
run one process at a time, your expensive CPU sits idle
for most of the time
- Solution: let multiple processes run at the same time
and switch between them when appropriate
,3|Page
(appropriate when one process is waiting for user input,
etc.)
CPU Virtualization - ...ANSWER... ✔ ✔- should
decide which program to run at any given time
- should divide CPU fairly across programs
- uses scheduling and multiprogramming to provide each
user with a portion of a time-shared computer
Memory Virtualization - ...ANSWER... ✔ ✔- gives
each process the same virtual address space (each
process has the illusion of having memory to itself)
- virtual address space is mapped to the physical
address space
Malloc - ...ANSWER... ✔ ✔- dynamically allocates
memory
- allocates some memory and returns a pointer to the
beginning of that region
- memory should be freed using free() when no longer
needed (to avoid memory leaks)
, 4|Page
Virtual Memory vs Shared Disk - ...ANSWER... ✔ ✔-
works because processes mostly need their own memory
space, and only sometimes need to share data
- works because most programs share disk data
Context Switching - ...ANSWER... ✔ ✔- when a
process is being executed, and then an interrupt causes
the CPU to change from its current task to run another
process
- when an interrupt occurs, the system must save the
current context of the process so it can come back from
the interrupt and restore that context and resume the
process
- context-switching is pure overhead since the system
does no useful work while switching
The Process - ...ANSWER... ✔ ✔- single task the
computer is doing
- a program that has loaded into memory and is
executing
- you write code (program), you compile it (executable),
you run the executable (process)