Operating Systems Test #1

Created by Phillip Hyams

List and briefly define the four main elements of a computer.
1. Processor: Controls operation & data processing functions. 2. Main Memory: Volatile storage for data & programs. 3. I/O Modules: Moves data between computer & external environment. 4. System Bus: Communication pathway among CPU, memory, & I/O.

1/83

TermDefinition
List and briefly define the four main elements of a computer.
1. Processor: Controls operation & data processing functions. 2. Main Memory: Volatile storage for data & programs. 3. I/O Modules: Moves data between computer & external environment. 4. System Bus: Communication pathway among CPU, memory, & I/O.
Define the two main categories of processor registers.
1. User-Visible Registers: Enable assembly programmers to minimize main memory references. 2. Control and Status Registers: Used by CPU & privileged OS routines to control execution.
In general terms, what are the four distinct actions that a machine instruction can specify?
1. Processor-Memory (data transfer). 2. Processor-I/O (data transfer). 3. Data Processing (arithmetic/logic operations). 4. Control (altering execution sequence, e.g., branches).
What is an interrupt?
A mechanism by which hardware modules or software can interrupt the normal processing sequence of the processor.
How can multiple interrupts be serviced by setting priorities?
The OS assigns priorities to interrupts. When a low-priority handler is running, a higher-priority interrupt can preempt it; the CPU saves state, runs the higher-priority routine, then resumes the lower-priority one.
What characteristics are observed while going down the memory hierarchy?
1. Decreasing cost per bit. 2. Increasing storage capacity. 3. Increasing access time (slower access). 4. Decreasing frequency of memory access by the processor.
What are the trade-offs that determine the size of cache memory?
Larger caches improve hit ratios, but are more expensive, take more chip space, and slightly increase latency for tag checks and data extraction.
What is the difference between a multiprocessor and a multicore system?
Multiprocessor: A system containing two or more complete, independent CPUs sharing memory/IO. Multicore: A single integrated circuit chip containing two or more execution cores.
What is the distinction between spatial locality and temporal locality?
Temporal Locality: Tendency to re-access memory locations that were recently accessed. Spatial Locality: Tendency to access memory locations physically close to recently accessed ones.
In general, what are the strategies for exploiting spatial locality and temporal locality?
Temporal Locality: Keep recently used data/instructions in fast cache memory. Spatial Locality: Fetch larger blocks (cache lines/pages) when a single location is requested.
What are three objectives of an OS design?
1. Convenience (makes computer user-friendly). 2. Efficiency (allows optimal resource usage). 3. Ability to evolve (permits modular upgrades without service disruption).
What is the kernel of an OS?
The core portion of the OS that contains the most frequently used functions, resides permanently in main memory, and executes in privileged/kernel mode.
What is multiprogramming?
A mode of operation where two or more programs reside in main memory simultaneously and share CPU processing time via interleaving.
What is a process?
A program in execution, composed of an executable program, associated data, and an execution context.
How is the execution context of a process used by the OS?
It contains state information (registers, PC, stack pointers, state flags) used by the OS to supervise, schedule, control, and restore process execution during context switches.
List five storage management responsibilities of a typical OS.
1. Process isolation. 2. Automatic allocation and management. 3. Support of modular programming. 4. Protection and access control. 5. Long-term persistent storage.
What is time slicing?
A technique where processor execution time is divided into small intervals (time slices/quanta) granted to each active process in turn.
Describe the round-robin scheduling technique.
Processes in the Ready state are kept in a circular queue. The scheduler assigns the CPU to each process for a fixed time quantum. If interrupted or unfinished, the process returns to the back of the queue.
Explain the difference between a monolithic kernel and a microkernel.
Monolithic Kernel: All OS services (filesystems, drivers, networking) run inside a single large kernel-mode address space. Microkernel: Only minimal core services (IPC, low-level scheduling) run in kernel mode; others run in user space.
What is multithreading?
A technique where a single process is split into multiple concurrent threads of execution that share the process's code, data, and memory space.
What do you understand by a distributed operating system?
An OS that coordinates a collection of independent networked computers, presenting them to the user as a single unified system.
What is an instruction trace?
The sequence of instructions that execute for a given program or process.
Explain the concept of a system state and mark its differences from a program.
A program is static code and data stored on disk/memory. System state represents dynamic execution properties (registers, memory mapping, active I/O handles, state phase).
For the 5-state process model, briefly define each state.
Running (currently executing), Ready (prepared to execute), Blocked/Waiting (waiting for an event/IO), New (created but not admitted), Exit (terminated/aborted).
What does it mean to preempt a process?
To forcibly remove a running process from the CPU and place it back into the Ready queue before its execution phase naturally finishes.
What is process swapping?
Moving part or all of a process image from main memory to secondary disk storage when physical RAM is depleted.
Why does the 7-state process model have two blocked states?
To distinguish between processes blocked in main memory (Blocked) versus processes blocked and swapped out to disk storage (Blocked/Suspend).
List four characteristics of a suspended process.
1. Not immediately available for execution. 2. May or may not be waiting on an event. 3. Placed in suspend state by an agent (self, parent, or OS). 4. Cannot execute until explicitly resumed.
For what types of entities does the OS maintain tables of information?
1. Memory tables 2. I/O tables 3. File tables 4. Process tables
What are the elements of a process image?
1. User Data (modifiable data/user stack). 2. User Program (executable code). 3. System Stack (parameters/control calls). 4. Process Control Block (PCB).
Why are two modes (user and kernel) needed?
To protect critical OS control structures and hardware resources from unauthorized or accidental modification by user applications.
What are the steps performed by an OS to create a new process?
1. Assign unique PID. 2. Allocate space (image, PCB). 3. Initialize PCB. 4. Set up linkages in scheduler queues. 5. Create auxiliary data/accounting structures.
What is the difference between an interrupt and a trap?
Interrupt: Asynchronous hardware event external to current instruction execution (timer, I/O completion). Trap: Synchronous software event caused by instruction execution errors (divide-by-zero, illegal memory access).
Give three examples of an interrupt.
1. Clock/Timer interrupt. 2. I/O completion interrupt. 3. Memory page fault interrupt.
What is the difference between a mode switch and a process switch?
Mode Switch: Changes CPU privilege mode (User to Kernel) without changing the active running process context. Process Switch: Saves active process state, updates PCB, and switches execution context to a different process.
In a multithreaded system, which elements belong to a TCB vs a PCB?
TCB: Processor state (registers, PC, stack pointer), thread state, scheduling priority. PCB: Virtual address space, memory mappings, global open file handles, IPC resources.
Why is a mode switch between threads cheaper than between processes?
Thread switching doesn't require updating virtual memory references (page tables, TLB flushes), and shared memory/resources stay active in hardware caches.
What are two separate characteristics embodied in the concept of process?
1. Resource Ownership (allocated virtual memory, I/O channels, files). 2. Scheduling/Execution (execution path and execution state).
Give four general examples of the use of threads in a single-user system.
1. Concurrent UI interactions with background rendering/saving. 2. Asynchronous I/O handling. 3. Modular multi-step calculations. 4. Parallel processing on multicore hardware.
How is a thread different from a process?
A process is an independent execution unit with its own memory space and resources; a thread is a lightweight execution unit running within a shared process container.
What are the advantages of using multithreading instead of multiple processes?
1. Faster creation time. 2. Faster termination time. 3. Faster context switching. 4. Highly efficient IPC through shared memory space.
List advantages and disadvantages of Kernel-Level Threads (KLTs).
Advantages: Kernel can schedule multiple threads on multiple cores; blocking one thread doesn't block whole process. Disadvantage: Thread switching requires a privilege mode switch to kernel.
Explain the concept of threads in the Clouds operating system.
Threads are decoupled from object spaces; a thread represents a single execution path moving across passive, encapsulated memory objects via invocations.
List four design issues for which concurrency is relevant.
1. Communication among processes. 2. Sharing and competing for resources. 3. Process synchronization. 4. CPU time allocation.
What are three contexts in which concurrency arises?
1. Multiprogramming (multiple applications running concurrently). 2. Structured applications (apps split into concurrent threads). 3. Operating System structure (OS executing parallel routines).
What is a race condition?
A situation where multiple processes/threads manipulate shared data concurrently, and the final outcome depends on the execution order.
List three degrees of awareness between processes.
1. Unaware (independent processes competing for resources). 2. Indirectly Aware (processes sharing common resources/buffers). 3. Directly Aware (processes communicating explicitly via PID/handles).
Distinguish between competing and cooperating processes.
Competing: Independent processes unaware of each other contending for system resources. Cooperating: Processes sharing resources or communicating to accomplish a task.
List the three control problems associated with competing processes.
1. Mutual Exclusion (enforcing single process entry to critical section). 2. Deadlock (processes waiting indefinitely on each other). 3. Starvation (process repeatedly denied access to resources).
What is starvation in mutual exclusion?
A situation where a runnable process is indefinitely delayed from entering its critical section because other processes are repeatedly given access.
What operations can be performed on a semaphore?
1. Initialize (set non-negative value). 2. semWait / P (decrement value; block if negative). 3. semSignal / V (increment value; unblock waiting process if <= 0).
What is the difference between binary and general semaphores?
Binary Semaphore: Value is restricted to 0 or 1. General/Counting Semaphore: Value can be initialized to any non-negative integer tracking available resource units.
What is the key difference between a mutex and a binary semaphore?
A mutex includes an ownership principle—only the thread/process that locked it can unlock it. A binary semaphore can be signaled by any thread.
Which characteristics mark monitors as high-level synchronization tools?
Monitors encapsulate shared data, local variables, and procedures into a module where mutual exclusion is enforced automatically by the compiler/runtime.
Compare direct and indirect addressing in message passing.
Direct Addressing: Send/Receive explicitly name the destination process ID. Indirect Addressing: Messages are sent to and received from shared queues/mailboxes/ports.
What conditions are associated with the readers/writers problem?
1. Multiple readers can read simultaneously. 2. Only one writer can write at a time. 3. If a writer is writing, no reader can read.
What is the Memory Address Register (MAR)?
A CPU register that specifies the memory address for the next read or write operation.
What is the Memory Buffer Register (MBR)?
A CPU register containing data to be written into memory or receiving data read from memory.
What is Direct Memory Access (DMA)?
A specialized hardware module that transfers entire blocks of data directly between I/O devices and main memory without continuous CPU intervention.
What is a Translation Lookaside Buffer (TLB)?
A high-speed hardware cache in the Memory Management Unit (MMU) that stores recent virtual-to-physical address translations to speed up memory access.
What is the difference between Spatial and Temporal Locality in cache design?
Temporal locality reuses recent data/instructions (kept in cache); Spatial locality accesses nearby contiguous memory locations (fetched via cache lines/pages).
What is the Principle of Locality?
The empirical observation that computer programs tend to access a small, localized portion of their address space at any given point in time.
What is Amdahl's Law?
A formula that calculates the theoretical speedup limit of a program when using multiple processors, constrained by the program's inherently serial portion.
What is a Process Control Block (PCB)?
The primary data structure created and maintained by the OS containing all execution state, scheduling, memory, and accounting info for a specific process.
What is the role of the Dispatcher in an OS?
The OS kernel module that physically performs the context switch, transferring control of the CPU to the process selected by the short-term scheduler.
What is the difference between User Mode and Kernel Mode?
User Mode restricts execution of privileged instructions and direct hardware access; Kernel Mode grants unconstrained access to CPU instructions and system memory.
What is the difference between User-Level Threads (ULTs) and Kernel-Level Threads (KLTs)?
ULTs are managed entirely in user space by a thread library without kernel awareness (fast, but one blocking call blocks all); KLTs are managed directly by the OS kernel.
What is the Many-to-One thread mapping model?
Maps multiple user-level threads to a single kernel thread. Thread management is fast, but entire process blocks if one thread makes a blocking call.
What is the One-to-One thread mapping model?
Maps each user thread to its own dedicated kernel thread. Enables parallel execution on multicore hardware, but has higher overhead.
What is the Many-to-Many thread mapping model?
Multiplexes many user-level threads onto a smaller or equal number of kernel threads, balancing concurrency and overhead.
What is a Critical Section?
A block of code accessing shared resources (variables, files, tables) that must not be executed by more than one process at a time.
What are the four necessary requirements for Mutual Exclusion?
1. Only one process in critical section at a time. 2. No assumptions about CPU speed/number. 3. No process outside critical section may block other processes. 4. No process waits indefinitely (no starvation/deadlock).
What is a Spinlock?
A lock where a process continuously checks a flag in a tight loop (busy-waiting) until the lock becomes available.
What is Peterson's Algorithm?
A classic software-based solution for mutual exclusion between two processes using shared variables (`turn` and `flag[]`) without hardware support.
What is a Counting Semaphore?
A synchronization primitive with an integer value representing the quantity of available shared resources.
What is Test-and-Set (TSL)?
An atomic hardware instruction that reads a memory location and sets its value to true in a single uninterruptible clock cycle, used to build synchronization locks.
What is Compare-and-Swap (CAS)?
An atomic hardware instruction that compares the contents of a memory location to a given value and, if equal, modifies it to a new value.
What is the Producer-Consumer Problem?
A classic synchronization problem where producer processes create data items placed into a shared bounded buffer, and consumer processes remove them without causing buffer overflow/underflow.
What is a Monitor in process synchronization?
A high-level programming language construct that encapsulates shared variables and operations, enforcing mutual exclusion automatically via condition variables.
What is the difference between `cwait` and `csignal` in Monitors?
`cwait(c)` blocks the calling process on condition `c`; `csignal(c)` resumes one process blocked on condition `c` (or does nothing if none are waiting).
What is Message Passing in IPC?
A synchronization and communication mechanism using `send()` and `receive()` primitives that works across both shared-memory and distributed systems.
What is the difference between Synchronous and Asynchronous Message Passing?
Synchronous (blocking): Sender blocks until receiver receives message. Asynchronous (non-blocking): Sender resumes execution immediately after sending.
What is the Readers-Writers Problem?
A concurrency problem where multiple threads read shared data concurrently, but writers require exclusive access to prevent data corruption.