1/147
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
HW1 Q1: Which best describes the role of the OS in a computer system? A) Provides basic computing resources such as CPU, memory, and I/O devices B) Solves the computing problems of users through word processors, browsers, or games C) Controls and coordinates the use of hardware among various applications and users D) None of the above
C) Controls and coordinates the use of hardware among various applications and users
HW1 Q2: Which component provides an environment for users to execute programs efficiently, allocates resources fairly, supervises program execution, and manages I/O devices? A) Hardware B) Operating System C) Application Programs D) Compiler
B) Operating System
HW1 Q3: Which best describes the basic computer system organization? A) A set of application programs that solve user problems B) One or more CPUs, memory, and I/O devices managed by device controllers connected through a common bus C) An OS that controls and coordinates access to hardware D) A compiler that translates high-level programs into machine instructions
B) One or more CPUs, memory, and I/O devices managed by device controllers connected through a common bus
HW1 Q4: Which statement about interrupts is true? A) Interrupts are only generated by hardware, never by software B) An interrupt transfers control to the interrupt service routine (ISR), allowing the OS to respond to events C) Software interrupts are used only to start new programs D) An OS is never interrupt-driven
B) An interrupt transfers control to the interrupt service routine (ISR), allowing the OS to respond to events
HW1 Q5: Which best distinguishes main memory from secondary storage? A) Main memory is nonvolatile and larger B) Main memory is volatile and directly accessed by the CPU, while secondary storage is nonvolatile and provides large capacity C) Both are volatile but differ in speed D) Secondary storage is directly accessed by the CPU
B) Main memory is volatile and directly accessed by the CPU, while secondary storage is nonvolatile and provides large capacity
HW1 Q6: Which best explains the purpose of dual-mode operation? A) Lets multiple CPUs share memory without conflicts B) Provides user and kernel modes so the system can distinguish application execution from OS execution, protecting the OS from improper access C) Lets the CPU run 32-bit and 64-bit instructions in one program D) Ensures only user programs can directly access hardware
B) Provides two modes, user and kernel, so the system can distinguish application execution from OS execution, protecting the OS from improper access
HW1 Q7: Which correctly distinguishes multiprocessor systems from dual-core processors? A) Multiprocessor = multiple cores on one chip; dual-core = separate chips B) Multiprocessor systems improve throughput and reliability with multiple processors; a dual-core processor integrates two cores on the same chip, often used in server systems C) Multiprocessors are less reliable; dual-core is only for gaming D) They are the same
B) Multiprocessor systems improve throughput and reliability using multiple processors; a dual-core processor integrates two cores on the same chip
HW1 Q8: Which correctly contrasts shared memory and message passing? A) Shared memory is simpler since the OS moves data B) Message passing is faster because no kernel involvement is needed C) Shared memory lets processes exchange data through a common memory region, while message passing has the OS move packets of data between processes D) Both require writing into each other's private address space
C) Shared memory = processes access a common memory region; message passing = the OS moves packets of data between processes
HW1 Q9: A boot block ____. A) typically only knows the location and length of the rest of the bootstrap program B) is sophisticated enough to load the OS and begin its execution C) is composed of multiple disk blocks D) is composed of multiple disk cylinders
A) typically only knows the location and length of the rest of the bootstrap program
HW1 Q10: Which correctly matches the OS monitoring/debugging technique with its purpose? A) Debugging: finding and fixing errors B) Logging: recording error information into files C) Tracing: collecting step-by-step data about events like system calls D) Profiling: sampling to detect performance trends E) All of the above
E) All of the above
HW2 Q1: Which components of program state are shared across threads in a multithreaded process? A) Register values B) Program counter C) Global variables D) Stack memory
C) Global variables
HW2 Q2: In the context of scheduler activations, what is an upcall? A) A communication from the kernel to the thread library B) A request from a user thread to the kernel C) A system call made by an application D) A method to cancel a thread
A) A communication from the kernel to the thread library
HW2 Q3: What is the purpose of a Process Control Block (PCB)? A) To store the compiled program code B) To manage the process stack C) To hold information associated with each process D) To execute process instructions
C) To hold information associated with each process
HW2 Q4: In process creation, what does the fork() system call do in UNIX? A) Terminates a process B) Creates a new process C) Replaces the process' memory space D) Waits for a child process to terminate
B) Creates a new process
HW2 Q5: What is a zombie process? A) A process that has terminated but whose parent hasn't called wait() B) A process without a parent C) A process stuck in an infinite loop D) A process that consumes excessive resources
A) A process that has terminated but whose parent hasn't called wait()
HW2 Q6: In the Producer-Consumer problem using shared memory, when is the buffer considered full? A) When in == out B) When ((in + 1) % BUFFER_SIZE) == out C) When in > out D) When BUFFER_SIZE is reached
B) When ((in + 1) % BUFFER_SIZE) == out (in == out means empty)
HW2 Q7: Which is NOT a benefit of using threads? A) Responsiveness B) Resource Sharing C) Economy D) Increased memory usage
D) Increased memory usage
HW2 Q8: In multicore programming, what does parallelism imply? A) Threads are interleaved over time B) A system can perform more than one task simultaneously C) Only one task at a time D) Threads always run sequentially
B) A system can perform more than one task simultaneously
HW2 Q9: Which multithreading model maps many user-level threads to a single kernel thread? A) Many-to-One B) One-to-One C) Many-to-Many D) One-to-Many
A) Many-to-One
HW2 Q10: What is the primary advantage of using thread pools? A) Increases the number of threads B) Allows unlimited thread creation C) Limits the number of threads that exist at any one point D) Eliminates the need for thread synchronization
C) It limits the number of threads that exist at any one point
HW3 Q1: How is the length of the next CPU burst typically estimated in SJF scheduling? A) Randomly B) By averaging the lengths of previous CPU bursts C) By user input D) By the OS's internal clock
B) By averaging the lengths of previous CPU bursts (exponential averaging)
HW3 Q2: What is processor affinity? A) A process using more CPU time than others B) The preference of a thread to run on the same processor C) A processor running only certain thread types D) How fast a processor switches threads
B) The preference of a thread to run on the same processor
HW3 Q3 (select all): Which are true about Round Robin scheduling? A) If the time quantum is large, it behaves like FIFO B) It always minimizes average waiting time C) If the time quantum is small, the overhead can be too high D) It is suitable for batch processing
A and C
HW3 Q4: What is the primary characteristic of a multilevel queue scheduling algorithm? A) All queues have the same priority B) Processes can move between queues C) Each queue has its own scheduling algorithm D) It uses a single ready queue
C) Each queue has its own scheduling algorithm
HW3 Q5 (select all): Which are true regarding thread scheduling? A) PCS involves competition among all threads in the system B) SCS involves competition among all threads in the system C) PCS is scheduling competition within the process D) SCS is typically done via priority set by the programmer
B and C
HW3 Q6: What is the purpose of push migration in load balancing? A) Move threads from idle to busy processors B) Periodically move tasks from overloaded CPUs to other CPUs C) Prevent threads from migrating D) Assign threads by affinity
B) To periodically move tasks from overloaded CPUs to other CPUs
HW3 Q7: Which statement about test-and-set instructions is TRUE? A) Test-and-set is a software-based solution B) Modern processors provide special hardware instructions, like test-and-set, to perform atomic operations C) Software-based synchronization always works on modern architectures D) Test-and-set only helps single-threaded applications
B) Modern processors provide special hardware instructions, like test-and-set, to perform atomic operations
HW3 Q8: In the semaphore solution to the bounded-buffer problem, mutex, empty and full are initialized to? (n = buffer size) A) mutex = 0, empty = 0, full = n B) mutex = 1, empty = n, full = 0 C) mutex = 1, empty = 0, full = n D) mutex = n, empty = 1, full = 0
B) mutex = 1, empty = n, full = 0
HW3 Q9: Which statement about semaphore waiting queues is TRUE? A) Each entry stores priority and execution time B) block moves a process to the semaphore's waiting queue, and wakeup moves a process from the waiting queue to the ready queue C) Waiting queues are only for binary semaphores D) All waiting processes are unblocked on wakeup
B) block moves a process to the waiting queue; wakeup moves a process from the waiting queue to the ready queue
HW3 Q10: Which POSIX mechanism lets a thread wait for a specific condition to be met before continuing? A) Mutex locks B) Semaphores C) Condition variables D) Barriers
C) Condition variables (pthread_cond_t)
Q: A(n) ____ is the unit of work in a system. A) process B) operating system C) timer D) mode bit
A) process
Protection
Controlling access of processes (or users) to resources
Security
Defense of the system against internal and external attacks (denial-of-service, worms, viruses, trojan horse, man-in-the-middle, etc.)
T/F: Security is equivalent to protection with no difference.
False
Monolithic structure (original UNIX)
A single, static, binary file that runs in a single address space
Monolithic: advantage / disadvantage
Advantage: communication with the kernel is fast. Disadvantage: too many functions packed into one layer
Layered approach
The OS is divided into a number of layers (levels), each built on top of the lower layer. The bottom layer (layer 0) is the hardware; the highest (layer N) is the user interface
Layered: advantage / disadvantage
Advantage: easy to debug (build from the hardware up, testing each layer first). Disadvantage: low efficiency, e.g., connect with I/O
Q: The major difficulty in designing a layered operating system approach is ____
A) appropriately defining the various layers
Microkernel
Moves as much from the kernel into user space; provides just a few essential services, and the rest of the OS is turned into separate user-level programs; communication between user modules uses message passing
Microkernel: benefits / disadvantage
Benefits: easier to extend; more reliable (less code running in kernel mode). Disadvantage: performance overhead of user space to kernel space communication. Example: Mach
Q: A microkernel is a kernel ____
D) that is stripped of all nonessential components
Modules (loadable kernel modules, LKMs)
Uses object-oriented approach; each core component is separate; each talks to the others over known interfaces; each is loadable as needed within the kernel
Modules: ADVANTAGES (not on slides)
Services loaded dynamically as needed without recompiling the kernel; modules call each other directly (no message passing, so faster than microkernel); flexible
Modules: DISADVANTAGES (not on slides)
Modules still run in kernel mode, so a faulty module can crash the whole system; less protection/isolation than a microkernel
Q: ____ allows operating system services to be loaded dynamically
B) Modules
Dual-mode operation
Allows OS to protect itself and other system components: user mode and kernel mode
Which programs run in user mode vs kernel mode?
Application programs run in user mode; OS programs run in kernel mode
Mode bit
Provides ability to distinguish when system is running user code or kernel code: 'user' when a user is running, 'kernel' when kernel code is executing
Q: What is another term for kernel mode? A) supervisor mode B) system mode C) privileged mode D) All of the above
D) All of the above
Q: Which should only be run in kernel mode? Read the clock / Clear memory / Issue an instruction / Turn off interrupts / Modify entries in device-status table
Clear memory, Turn off interrupts, Modify entries in device-status table
Timer
Prevents infinite loop or process hogging resources: set counter to predefined number, OS decrements it, when counter = 0 generate an interrupt. OS sets the timer before turning over control to the user
Q: A ____ can be used to prevent a user program from never returning control to the operating system
D) timer
T/F: Interrupts may be triggered by either hardware or software
True
System calls
Programming interface to the services provided by the OS; typically written in C or C++; mostly accessed by programs via a high-level API rather than direct system call use
System call interface
Invokes the intended system call in OS kernel and returns status of the system call and any return values
Yes/No: System call interface is the boundary between user programs and operating system services
Yes
3 methods to pass parameters to a system call
1) In registers 2) In a block (table) in memory, with the block's address passed in a register (Linux) 3) Pushed onto the stack by the program and popped off by the OS. Block and stack do not limit number or length of parameters
Q: ____ is/are not a technique for passing parameters from an application to a system call
A) Cache memory
T/F: System calls can be run in either user mode or kernel mode
False
Process
A program in execution
Program vs. process
Program is a passive entity stored on disk (executable file); process is active. A program becomes a process when an executable file is loaded into memory
Text section
The compiled program code
Data section
Contains global variables
Heap
Used for dynamic memory allocation; managed via calls to new, delete, free, etc.
Stack
Contains temporary data: function parameters, return addresses, local variables
Memory layout of a process, top (high address) to bottom (low address)
Stack, (free space), heap, data, text. Stack grows down, heap grows up (from the slide's memory layout figure)
Q: The ____ of a process contains temporary data such as function parameters, return addresses, and local variables
D) stack
Process state: New
The process is being created
Process state: Running
Instructions are being executed
Process state: Waiting
The process is waiting for some event to occur
Process state: Ready
The process is waiting to be assigned to a processor
Process state: Terminated
The process has finished execution
Q: A process may transition to the Ready state by A) completion of an I/O event B) awaiting its turn on the CPU C) newly-admitted process D) All of the above
D) All of the above
Process Control Block (PCB)
Information associated with each process (also called task control block)
Context switch
Occurs when the CPU switches from one process to another: the system must save the state of the old process and load the saved state for the new process
Q: A ____ saves the state of the currently running process and restores the state of the next process to run
C) context switch
fork()
System call that creates a new process
exec()
System call used after a fork() to replace the process' memory space with a new program
wait()
Parent waits for termination of a child; returns status information and the pid of the terminated process: pid = wait(&status);
exit()
Process executes last statement and asks the OS to delete it; returns a status value from child to parent; process' resources are deallocated by OS
Cascading termination
If a process terminates, all its children, grandchildren, etc. are terminated; initiated by the OS
Orphan process
A process whose parent terminated without invoking wait()
Q: The ____ process is assigned as the parent to orphan processes
B) init (it periodically invokes wait() to collect the orphan's exit status)
Q: When a child process is created, which is a possibility? A) runs concurrently with parent B) has a new program loaded C) is a duplicate of the parent D) All of the above
D) All of the above
Thread
A basic unit of CPU utilization; comprises a thread ID, a program counter (PC), a register set, and a stack
T/F: A traditional (or heavyweight) process has a single thread of control.
True
T/F: A thread is composed of a thread ID, program counter, register set, and heap.
False (stack, not heap)
T/F: Each thread has its own register set and stack.
True
Concurrency
The execution of the threads will be interleaved over time
Parallelism
A system can perform more than one task simultaneously
T/F: It is possible to have concurrency without parallelism.
True
One-to-One model
Each user-level thread maps to a kernel thread. Drawback: a large number of kernel threads may burden performance. Use case: high-performance apps (web servers, databases)
Many-to-Many model
Allows many user-level threads to be mapped to many kernel threads; OS can create a sufficient number of kernel threads. Use case: balanced workload applications
Q: The ____ model multiplexes many user-level threads to a smaller or equal number of kernel threads
C) many-to-many model
Thread library
Provides programmer with API for creating and managing threads
Q: A ____ provides an API for creating and managing threads
C) thread library
Pthreads
A standard (IEEE 1003.1c) API for thread creation and synchronization; may be provided either as user-level or kernel-level; common in UNIX OSes (Linux & Mac OS X)
Q: A ____ uses an existing thread rather than creating a new one to complete a task
B) thread pool
Amdahl's Law
Identifies performance gains from adding additional cores to an application that has both serial and parallel components