Define an operating system.
A program that acts as an intermediary between a user of a computer and the computer hardware.
What are the three operating system goals?
Execute user programs and make solving user problems easier; make the computer system convenient to use; use the computer hardware in an efficient manner.
OS as a resource allocator vs OS as a control program.
Resource allocator: manages all resources and decides between conflicting requests for efficient and fair resource use. Control program: controls execution of programs to prevent errors and improper use of the computer.
What is the kernel?
"The one program running at all times on the computer." Everything else is either a system program (ships with the OS) or an application program.
Name the four components of a computer system.
Hardware, operating system, application programs, users.
What is the role of the operating system among the four components?
It controls and coordinates use of hardware among various applications and users.
Where is BIOS stored, and what is it generally known as?
In ROM or EPROM; it is generally known as firmware.
What does the bootstrap program in the boot sector do?
It is loaded in memory and starts the process of loading the operating system kernel and starts execution.
How does a device controller tell the CPU that it has finished its operation?
By causing an interrupt.
What does the interrupt vector contain?
The addresses of all the service routines.
What is a trap?
A software-generated interrupt caused either by an error or a user request.
Why are incoming interrupts disabled while another interrupt is being processed?
To prevent a lost interrupt.
Two ways the OS determines which type of interrupt has occurred.
Polling, or a vectored interrupt system.
Synchronous vs asynchronous I/O: when does control return to the user program?
Synchronous: only upon I/O completion. Asynchronous: without waiting for I/O completion.
What does each device-status table entry indicate?
The device's type, address, and state; if the device is busy, the type of request and other parameters are stored in its entry.
DMA: how many interrupts per transfer?
Only one interrupt is generated per block, rather than one interrupt per byte; the controller transfers blocks directly to main memory without CPU intervention.
Which is the only large storage media the CPU can access directly?
Main memory.
By what three properties is the storage hierarchy organized? What is at the top and bottom?
Speed, cost and volatility. Registers at the top; magnetic tapes at the bottom (slide 20).
What is caching?
Copying information into a faster storage system; information in use is copied from slower to faster storage temporarily, and the cache is checked first.
What is the cache-consistency concern in multitasking environments?
They must be careful to use the most recent value, no matter where it is in the storage hierarchy.
Three advantages of multiprocessor systems.
Increased throughput; economy of scale; increased reliability (graceful degradation or fault tolerance).
Multiprogramming vs timesharing.
Multiprogramming organizes jobs so the CPU always has one to execute (switching when a job waits). Timesharing is its logical extension: the CPU switches jobs so frequently that users can interact with each job while it is running.
In timesharing, what should the response time be?
Less than 1 second.
What is the mode bit, and who provides it?
A bit provided by hardware that distinguishes when the system is running user code or kernel code.
Where can privileged instructions be executed?
Only in kernel mode.
Why does the OS use a timer?
To prevent an infinite loop / a process hogging resources: the counter is decremented and an interrupt is generated at zero, so the OS regains control or terminates a program that exceeds its allotted time.
Define a process.
A program in execution; process execution must progress in sequential fashion.
What three things does a process include?
Program counter, stack, data section.
Name the five process states.
New, running, waiting, ready, terminated.
Ready vs waiting state.
Ready: the process is waiting to be assigned to a processor. Waiting: the process is waiting for some event to occur.
Which event moves a process from running back to ready?
An interrupt (slide 8).
Where does a waiting process go when its I/O or event completes?
To the ready state (not directly to running).
List the information kept in a PCB.
Process state, program counter, CPU registers, CPU scheduling information, memory-management information, accounting information, I/O status information.
Job queue vs ready queue vs device queues.
Job queue: all processes in the system. Ready queue: processes in main memory, ready and waiting to execute. Device queues: processes waiting for an I/O device.
What does the long-term (job) scheduler select?
Which processes should be brought into the ready queue.
What does the short-term (CPU) scheduler select?
Which process should be executed next, and it allocates the CPU.
Which scheduler must be fast, and why?
The short-term scheduler, because it is invoked very frequently (milliseconds).
Which scheduler controls the degree of multiprogramming?
The long-term scheduler (the degree of multiprogramming = the number of processes in memory).
I/O-bound vs CPU-bound process.
I/O-bound: more time doing I/O than computations, many short CPU bursts. CPU-bound: more time doing computations, few very long CPU bursts.
What does medium-term scheduling add to the queueing diagram?
Partially executed processes can be swapped out and later swapped in to the ready queue.
What happens during a context switch?
The system saves the state of the old process and loads the saved state for the new process; the context is represented in the PCB.
Why is context-switch time called overhead?
Because the system does no useful work while switching; the time depends on hardware support.
Three options for resource sharing between parent and child.
Share all resources; children share a subset of the parent's resources; share no resources.
Why restrict a child to a subset of the parent's resources?
It prevents any process from overloading the system by creating too many subprocesses.
fork vs exec in UNIX.
fork creates a new process; exec is used after a fork to replace the process' memory space with a new program.
After pid = fork(), what does pid == 0 mean?
The code is running in the child process (which then calls execlp to run ls).
Three reasons a parent may abort a child.
The child has exceeded allocated resources; the task assigned to the child is no longer required; the parent is exiting (some OSs do not allow the child to continue).
What is cascading termination?
When a parent terminates in an OS that does not allow a child to continue without it, all its children are terminated.
What is the CPU–I/O burst cycle?
Process execution consists of a cycle of CPU execution and I/O wait.
How are CPU-burst lengths generally distributed?
Exponentially: many short bursts, few long bursts.
Under which of the four decision points is scheduling nonpreemptive?
Only under 1 (running → waiting) and 4 (terminates); all other scheduling is preemptive.
Why is preemptive scheduling harder to implement?
It must maintain consistency of data shared between processes and, more importantly, kernel data structures (e.g., I/O queues).
What three things does dispatching involve?
Switching context; switching to user mode; jumping to the proper location in the user program to restart that program.
Define dispatch latency.
The time it takes for the dispatcher to stop one process and start another running.
Throughput vs turnaround time.
Throughput: # of processes that complete their execution per time unit (maximize). Turnaround: time from submission to termination of a process (minimize).
Define waiting time.
The amount of time a process has been waiting in the ready queue.
Define response time.
The time from when a request is submitted until the first response is produced, not output (for timesharing environments).
What is the convoy effect?
Short processes stuck behind a long process (in FCFS).
Why is FCFS not useful for interactive users?
Because it cannot guarantee good response time.
Why is SJF called optimal, and what is its difficulty?
It gives the minimum average waiting time for a given set of processes; the difficulty is knowing the length of the next CPU request.
What is SRTF?
Preemptive SJF: if a new process arrives with a CPU burst shorter than the remaining time of the current process, preempt it.
P1 (arrives 0.0, burst 7), P2 (2.0, 4), P3 (4.0, 1), P4 (5.0, 4): average waiting time with nonpreemptive SJF vs SRTF?
Nonpreemptive SJF: (0 + 6 + 3 + 7)/4 = 4. SRTF: (9 + 1 + 0 + 2)/4 = 3.
Exponential averaging formula.
τₙ₊₁ = α tₙ + (1 − α) τₙ, with 0 ≤ α ≤ 1 (tₙ = actual nth burst, τₙ₊₁ = predicted next burst).
What do α = 0 and α = 1 mean?
α = 0: τₙ₊₁ = τₙ, recent history does not count. α = 1: τₙ₊₁ = tₙ, only the actual last CPU burst counts.
In priority scheduling, which number is the highest priority?
The smallest integer.
Starvation and aging.
Starvation: low-priority processes may never execute. Aging: as time progresses, increase the priority of the process.
How is SJF related to priority scheduling?
SJF is a priority scheduling where priority is the predicted next CPU burst time.
Round robin: maximum wait with n processes and quantum q.
No process waits more than (n − 1)q time units; each gets 1/n of the CPU time in chunks of at most q.
RR: what happens if q is very large? very small?
q large ⇒ FIFO. q small ⇒ q must be large with respect to context switch, otherwise overhead is too high.
RR compared with SJF.
Typically higher average turnaround than SJF, but better response.
Two ways to schedule between the queues of a multilevel queue.
Fixed priority preemptive scheduling (serve all foreground then background; possible starvation), or time slice (e.g., 80% foreground in RR, 20% background in FCFS).
Multilevel queue vs multilevel feedback queue.
In a multilevel feedback queue a process can move between the queues (aging can be implemented this way).
In the Q0/Q1/Q2 example, when is a job moved to Q2?
If it still does not complete after 8 ms in Q0 plus 16 additional ms in Q1 (24 ms); at Q2 it is served FCFS.
What is the big issue in managing multiple processes?
Concurrency — managing the interaction of all of these processes (multiprogramming, multiprocessing, distributed processing).
Three contexts in which concurrency arises.
Multiple applications (sharing time); structured applications (extension of modular design); operating system structure (OS as a set of processes or threads).
Why are concurrency errors difficult to locate?
Because results are not deterministic and reproducible.
Define an atomic operation.
A sequence of one or more instructions that appears to be indivisible: no other process can see an intermediate state or interrupt it; it executes as a group, or not at all.
Deadlock vs livelock.
Deadlock: processes cannot proceed because each waits for another. Livelock: processes continuously change state in response to each other without doing any useful work.
Define mutual exclusion.
When one process is in a critical section that accesses shared resources, no other process may be in a critical section that accesses any of those shared resources.
Define starvation (concurrency key terms).
A runnable process is overlooked indefinitely by the scheduler; although it is able to proceed, it is never chosen.
On what does the output depend in a race condition?
On the order of execution — on who finishes the race last.
Three control problems of competition among processes.
1. Need for mutual exclusion (critical sections); 2. deadlock; 3. starvation.
Which relationship do processes that are unaware of each other have (Table 5.2)?
Competition.
Which interaction adds the "data coherence" control problem?
Processes indirectly aware of each other (e.g., shared object) — cooperation by sharing.
List the six requirements for mutual exclusion.
One process at a time in the critical section; halting in a noncritical section without interfering; no deadlock or starvation; no delay when the critical section is free; no assumptions about speeds or number of processes; finite time inside the critical section.
Why does disabling interrupts not work on multiprocessors?
Disabling interrupts guarantees mutual exclusion only because uniprocessors only allow interleaving; it will not work in a multiprocessor architecture.
What is another name for the compare&swap instruction?
The compare and exchange instruction.
Three disadvantages of hardware mutual exclusion (special instructions).
Busy-waiting consumes processor time; starvation is possible; deadlock is possible.
What are the three atomic operations on a semaphore?
Initialize, decrement (semWait), increment (semSignal).
What does semWait(s) do?
s.count--; if s.count < 0, place the process in s.queue and block it.
What does semSignal(s) do?
s.count++; if s.count <= 0, remove a process P from s.queue and place it on the ready list.
Strong vs weak semaphore.
Strong semaphores remove waiting processes in FIFO order; weak semaphores don't specify the order of removal from the queue.
State the producer/consumer problem.
Ensure that the producer can't add data into a full buffer and the consumer can't remove data from an empty buffer (only one may access the buffer at a time).
Bounded buffer: when does the producer wait and when does the consumer wait?
Producer: while ((in + 1) % n == out) — buffer full. Consumer: while (in == out) — buffer empty.
What is a monitor?
A programming-language construct that provides equivalent functionality to that of semaphores and that is easier to control.
Three chief characteristics of a monitor.
Local data variables accessible only by the monitor; a process enters by invoking one of its procedures; only one process may be executing in the monitor at a time.
cwait(c) vs csignal(c).
cwait(c): suspend execution of the calling process on condition c. csignal(c): resume execution of some process blocked after a cwait on the same condition.
Why must memory be allocated carefully?
To ensure a reasonable supply of ready processes to consume available processor time.
List the five memory management requirements.
Relocation, protection, sharing, logical organisation, physical organisation.
Why is relocation needed?
The programmer does not know where the program will be placed; it may be swapped to disk and return to main memory at a different location, so references must be translated to the actual physical address.
Why must memory protection be checked at run time?
Because it is impossible to check absolute addresses at compile time.
What is overlaying, and its drawback?
It allows various modules to be assigned the same region of memory, but it is time consuming to program.
Frame vs page vs segment.
Frame: fixed-length block of main memory. Page: fixed-length block of data in secondary memory. Segment: variable-length block of data in secondary memory.
What has virtual memory evolved from?
From the partitioning methods.
Two problems of equal-size fixed partitioning.
A program may not fit (needs overlays); memory use is inefficient — any program, however small, occupies an entire partition (internal fragmentation).
Placement with unequal-size fixed partitions.
Assign each process to the smallest partition within which it will fit (a queue for each partition), minimizing wasted memory within a partition.
Remaining problems with fixed partitions.
The number of active processes is limited by the pre-determined number of partitions; many very small processes will not use the space efficiently.
How much memory does a process get with dynamic partitioning?
Exactly as much memory as required (partitions are of variable length and number).
External fragmentation and its remedy.
Memory external to all processes is fragmented; it can be resolved using compaction (the OS moves processes so they are contiguous), which is time consuming and wastes CPU time.
Best-fit: how does it choose, and how does it perform?
The block closest in size to the request; it is the worst performer overall — it leaves the smallest fragments, so compaction must be done more often.
Which placement algorithm is the fastest?
First-fit (scans from the beginning and chooses the first block that is large enough).
Next-fit: where does it scan from, and what does it break up?
From the location of the last placement; it often allocates at the end of memory, breaking up the largest block into smaller blocks.
Logical vs relative vs physical address.
Logical: independent of the current assignment of data to memory. Relative: relative to some known point. Physical/absolute: the actual location in main memory.
What do the base and bounds registers hold?
Base: the starting address for the process. Bounds: the ending location of the process. Set when the process is loaded or swapped in.
How is an absolute address produced and checked at run time?
Base register + relative address = absolute address; it is compared with the bounds register; if not within bounds, an interrupt is generated to the OS.
Simple paging: what are pages and frames?
Memory is partitioned into equal fixed-size chunks (frames) and each process into chunks of the same size (pages); page size = frame size.
What does a process page table contain?
The frame location for each page in the process.
Segmentation addressing and its similarity.
An address is a segment number and an offset; segmentation is similar to dynamic partitioning.
What limits the size of virtual storage?
The addressing scheme of the computer system and the amount of secondary memory available — not the actual number of main storage locations.
Virtual address space vs real address.
Virtual address space: the virtual storage assigned to a process. Real address: the address of a storage location in main memory.
The two key points that make virtual memory possible.
1. Memory references are logical addresses dynamically translated into physical addresses at run time. 2. A process may be broken into pieces that need not be contiguous in main memory.
What is the resident set?
The portion of a process that is in main memory.
What happens when a needed address is not in main memory?
An interrupt is generated and the process is blocked; the OS issues a disk read, dispatches another process meanwhile, and when the I/O completes puts the process back in the Ready state.
Two implications of executing processes partly in memory.
More processes may be maintained in main memory; a process may be larger than all of main memory.
Define thrashing.
A state in which the system spends most of its time swapping pieces rather than executing instructions.
State the principle of locality and why it matters.
Program and data references within a process tend to cluster, so only a few pieces are needed over a short period; intelligent guesses are possible, so virtual memory may work efficiently.
Which two extra bits does a page table entry need?
One for whether the page is in main memory or not; one for whether its contents have been altered since it was last loaded.
Where are page tables stored?
Also in virtual memory; when a process is running, part of its page table is in main memory.
What is the drawback of ordinary page tables that inverted page tables address?
Their size is proportional to that of the virtual address space.
Fields of an inverted page table entry.
Page number; process identifier (owner); control bits (valid, referenced, locking); chain pointer (index of the next entry in the chain).
What does the TLB contain?
The page table entries that have been most recently used (a high-speed cache for page table entries).
TLB hit vs TLB miss.
Hit: the frame number is retrieved and the real address is formed. Miss: the page number is used to index the process page table.
Why must each TLB entry include the page number?
Because the TLB contains only some of the page table entries, so it cannot be indexed by page number; the processor queries many entries simultaneously (associative mapping).
Effects of a smaller page size.
Less internal fragmentation, but more pages per process, larger page tables, and a large portion of page tables in virtual memory.
Why is a large page size better for secondary memory?
Secondary memory is designed to efficiently transfer large blocks of data.
Combined paging and segmentation: which is visible to the programmer?
Segmentation is visible; paging is transparent; each segment is broken into fixed-size pages.
Demand paging vs prepaging.
Demand paging brings a page in only when a reference is made to it (many faults at start). Prepaging brings in more pages than needed (efficient for pages contiguous on disk).
When is the placement policy important?
In a segmentation system; with paging (or combined paging and segmentation) hardware performs address translation.
What may not be replaced, and what kinds of frames are locked?
A locked frame may not be replaced: the kernel of the OS, key control structures, I/O buffers; a lock bit is associated with each frame.
Optimal replacement: which page, and what is its problem?
The page for which the time to the next reference is the longest; it is impossible to have perfect knowledge of future events.
Why is LRU difficult to implement?
One approach is to tag each page with the time of last reference, which requires a great deal of overhead.
How does FIFO treat the page frames of a process?
As a circular buffer: pages are removed in round-robin style, replacing the page that has been in memory the longest.
Page stream 2 3 2 1 5 2 4 5 3 2 5 2 with 3 frames: faults after the frames fill for optimal, LRU and FIFO?
Optimal 3, LRU 4, FIFO 6.
The three categories of I/O device.
Human readable, machine readable, communications.
Give examples of machine-readable devices.
Disk drives, USB keys, sensors, controllers, actuators — used to communicate with electronic equipment.
What are communication devices used for? Examples?
To communicate with remote devices — digital line drivers, modems.
Six areas in which I/O devices differ.
Data rate, application, complexity of control, unit of transfer, data representation, error conditions.
Unit of transfer: terminal I/O vs disk I/O.
Terminal I/O: a stream of bytes or characters. Disk I/O: larger blocks.
How can the application affect the handling of a disk?
A disk storing files requires file management software; a disk storing virtual memory pages needs special hardware and software to support it.
Programmed I/O vs interrupt-driven I/O (Table 11.1).
Both transfer I/O-to-memory through the processor; programmed I/O uses no interrupts, interrupt-driven I/O uses interrupts.
Which technique does a direct I/O-to-memory transfer?
Direct memory access (DMA), with the use of interrupts.
What does the I/O-bus DMA configuration reduce?
The number of I/O interfaces in the DMA module.
Why does swapping not fully solve the I/O efficiency problem?
Swapping is used to bring in ready processes, but swapping is an I/O operation itself.
Hierarchical design: how do layers relate?
Each layer relies on the next lower layer for more primitive functions and provides services to the next higher layer; changes in one layer should not require changes in others.
Why must certain pages remain in main memory during I/O?
To avoid deadlock.
Access time is the sum of which two times?
Seek time (position the head at the desired track) + rotational delay (beginning of the sector reaches the head).
Define rotational delay (rotational latency).
The time it takes for the beginning of the sector to reach the head.
FIFO disk scheduling: two properties.
Fair to all processes; approaches random scheduling in performance if there are many processes.
Why is priority disk scheduling a poor policy for database systems?
Its goal is not to optimize disk use but to meet other objectives, and longer jobs may have to wait an excessively long time.
LIFO disk scheduling: good for what, and what is its risk?
Good for transaction processing systems (little arm movement); possibility of starvation since a job may never regain the head of the line.
How does SSTF choose the next request?
The request that requires the least movement of the disk arm from its current position (minimum seek time).
SCAN vs C-SCAN.
SCAN moves in one direction serving requests, then reverses. C-SCAN serves in one direction only; at the end, the arm returns to the opposite end and the scan begins again.
What is N-step-SCAN?
It segments the disk request queue into subqueues of length N, processed one at a time using SCAN; new requests are added to another queue.
What is FSCAN?
Two subqueues: new requests go into the other (empty) queue, and their service is deferred until all old requests have been processed.
Head starts at track 100; requests 55, 58, 39, 18, 90, 160, 150, 38, 184. Average seek length for FIFO, SSTF, SCAN and C-SCAN?
FIFO 55.3; SSTF 27.5; SCAN 27.8; C-SCAN 35.8.
Three desirable properties of files.
Long-term existence; sharable between processes; structure.
What does a file management system consist of?
System utility programs that run as privileged applications; it is concerned with secondary storage.
Typical file operations.
Create, delete, open, close, read, write.
Name four objectives of a file management system.
Any four of: meet users' data management needs; guarantee the data are valid; optimize performance; I/O support for a variety of storage devices; minimize lost or destroyed data; standardized I/O interface routines; I/O support for multiple users.
Five criteria for file organisation.
Short access time; ease of update; economy of storage; simple maintenance; reliability.
Five file organisation types.
Pile; sequential file; indexed sequential file; indexed file; direct, or hashed, file.
Who owns the directory, and what mapping does it provide?
The directory itself is a file owned by the operating system; it provides the mapping between file names and the files themselves.
Which directory elements are address information?
Volume (device on which the file is stored), starting address, size used, size allocated.
Size used vs size allocated.
Size used: the current size of the file in bytes, words, or blocks. Size allocated: the maximum size of the file.
Give four usage-information directory elements.
E.g., date created, identity of creator, date last read access, identity of last reader, date last modified, identity of last modifier, date of last backup, current usage.
Two problems of the simple list directory.
It provides no help in organizing the files and forces the user to be careful not to use the same name for two different files.
Two-level directory scheme: structure and limitation.
One directory per user plus a master directory (entry per user with address and access control information); it does not provide structure for collections of files.
When are duplicate filenames possible?
In a tree-structured directory, if they have different pathnames.
The two issues of file sharing.
Access rights; management of simultaneous access.
Execution vs reading access right.
Execution: the user can load and execute a program but cannot copy it. Reading: the user can read the file for any purpose, including copying and execution.
Appending vs updating access right.
Appending: add data but cannot modify or delete any contents. Updating: modify, delete, and add to the file's data.
The four user classes.
Owner, specific users, user groups, all.
Records vs blocks.
Records are the logical unit of access of a structured file; blocks are the unit for I/O with secondary storage.
Where is the internal fragmentation in fixed blocking?
The unused space at the end of a block.
How is a record continued in variable-length spanned blocking?
By a pointer to the successor block.
Why does unspanned blocking waste space?
The remainder of a block cannot be used if the next record is larger than the remaining unused space.
Why do users tend to overestimate file size with preallocation?
It is difficult to reliably estimate the maximum potential size of the file, so they overestimate so as not to run out of space.
Portion size: the two extremes and the trade-off.
A portion large enough for the entire file, or one block at a time; a trade-off between single-file efficiency and overall system efficiency.
Contiguous allocation: FAT entry and problem.
A single entry with the starting block and length of the file; external fragmentation will occur, so compaction is needed.
Chained allocation: how are blocks linked, and what is it best for?
Each block contains a pointer to the next block in the chain; no external fragmentation; best for sequential files.
What does the file allocation table hold with indexed allocation?
The block number for the file's index; the one-level index has one entry for each portion allocated to the file.
Indexed allocation: fixed-size vs variable-sized blocks.
Allocating by (fixed-size) blocks eliminates external fragmentation; variable-sized blocks improve locality; both require occasional consolidation.
What is the fundamental idea of virtual machines?
Abstract hardware of a single computer into several different execution environments.
Host vs VMM vs guest.
Host: the underlying hardware system. VMM/hypervisor: creates and runs VMs, providing an interface identical to the host. Guest: a process provided with a virtual copy of the host, usually an OS.
What is a Type 0 hypervisor? Examples?
A hardware-based solution providing VM creation and management via firmware — IBM LPARs, Oracle LDOMs.
What is a Type 1 hypervisor? Examples?
Operating-system-like software built to provide virtualization — VMware ESX, Joyent SmartOS, Citrix XenServer (also general-purpose OSs with VMM functions: Windows Server with HyperV, RedHat Linux with KVM).
What is a Type 2 hypervisor? Examples?
An application that runs on a standard OS but provides VMM features to guest OSs — VMware Workstation and Fusion, Parallels Desktop, Oracle VirtualBox.
Paravirtualization in one line.
The guest operating system is modified to work in cooperation with the VMM to optimize performance.
Why is application containment "not virtualization at all"?
It provides virtualization-like features by segregating applications from the operating system (e.g., Solaris Zones, BSD Jails, IBM AIX WPARs), not by virtualizing hardware.
When and where did virtualization first appear?
In IBM mainframes in 1972, allowing multiple users to share a batch-oriented system.
The three points of the formal definition of virtualization.
1. The VMM provides an environment essentially identical to the original machine; 2. programs show only minor performance decreases; 3. the VMM is in complete control of system resources.
Snapshot vs clone.
Snapshot: save a given state and be able to restore back to it. Clone: create a copy and run both original and copy.
What is templating?
Create an OS + application VM, provide it to customers, and use it to create multiple instances of that combination.
How do virtualization features relate to cloud computing?
All those features taken together → cloud computing: using APIs, programs tell cloud infrastructure (servers, networking, storage) to create new guests, VMs, virtual desktops.
What does a VCPU represent?
The state of the CPU per guest as the guest believes it to be.
In which real mode do virtual user mode and virtual kernel mode run?
Both run in real user mode.
Trap-and-emulate: what happens when the guest attempts a privileged instruction in user mode?
It causes an error → trap; the VMM gains control, analyzes the error, executes the operation as attempted by the guest, and returns control to the guest in user mode.
Trap-and-emulate: which guest code runs slower?
Kernel-mode privileged code (user-mode code runs at the same speed as if not a guest).
Why does popf break trap-and-emulate?
In user mode it replaces only some flags and no trap is generated, so the VMM never gets control (earlier x86 lacks a clean privileged/nonprivileged separation).
Binary translation: what happens to special vs non-special instructions in guest kernel mode?
Non-special instructions run natively; special instructions are translated into a new set of instructions that perform an equivalent task.
What did Intel VT-x and AMD-V remove the need for?
Binary translation (they add "guest" and "host" CPU modes).
What is virtual machine sprawl?
Lots of VMs whose history and state are difficult to track — a result of VM creation being simpler and faster than a physical install.
Two characteristics of Type 0 hypervisors.
E.g.: a HW feature implemented by firmware; each guest has dedicated HW; smaller feature set; I/O a challenge; can provide virtualization-within-virtualization.
Where are Type 1 hypervisors commonly found, and in which mode do they run?
In company datacenters ("datacenter operating systems"); they run in kernel mode, natively on the hardware.
Type 2: main drawback and main benefit.
Drawback: poorer overall performance (can't use some HW features). Benefit: requires no changes to the host OS.
What is a hypercall?
A call to the hypervisor; in Xen paravirtualization the guest uses it when page-table changes are needed.
Virtualization vs emulation: the CPU requirement.
Virtualization requires the underlying CPU to be the same as the guest was compiled for; emulation allows the guest to run on a different CPU by translating all guest instructions.
How many kernels run with application containment (zones)?
Only one — the host OS kernel.
What is live migration?
Moving a running guest between systems without interrupting user access to the guest or its apps.
Live migration: why is step 4 repeated?
During step 4 (sending read-write pages) some pages were probably modified by the guest and are now dirty, so they must be sent again.