OS MIDTERM Flashcards

1
Q

What is the primary goal of CPU scheduling?
A. Maximize memory usage
B. Minimize I/O bursts
C. Maximize CPU utilization
D. Reduce thread priority

A

Maximize CPU utilization

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the CPU-I/O burst cycle?
A. A process runs only on the CPU
B. A cycle alternating between memory and storage
C. A repeating sequence of CPU execution and I/O wait
D. A thread execution pattern

A

A repeating sequence of CPU execution and I/O wait

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which part of a process begins the execution cycle?
A. I/O burst
B. Termination burst
C. CPU burst
D. Memory request

A

CPU burst

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When must the CPU scheduler make a decision?
A. Process finishes
B. Switch from waiting to ready
C. Switch from running to ready
D. All of the above

A

All of the above

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which of the following situations does NOT involve a scheduling choice?
A. Process terminates
B. Process switches from waiting to ready
C. Process switches from running to ready
D. Process switches from running to waiting

A

Process switches from running to waiting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is dispatch latency?
A. Time CPU remains idle
B. Time to process I/O
C. Time to stop one process and start another
D. Time to execute entire process

A

Time to stop one process and start another

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which type of scheduling may cause race conditions with shared data?
A. Non-preemptive
B. Preemptive
C. SJF
D. FCFS

A

Preemptive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which metric is the time from request submission to the first response?
A. Waiting time
B. Turnaround time
C. Response time
D. Throughput

A

Response time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following is NOT a scheduling optimization criteria?
A. Minimize context switching
B. Maximize CPU utilization
C. Minimize turnaround time
D. Minimize waiting time

A

Minimize context switching

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which algorithm uses a FIFO queue?
A. Round Robin
B. FCFS
C. SJF
D. Priority

A

FCFS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What problem is common in FCFS scheduling?
A. Memory fragmentation
B. CPU starvation
C. Convoy effect
D. Context switching

A

Convoy effect

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which algorithm minimizes average waiting time?
A. FCFS
B. Round Robin
C. SJF
D. Priority Scheduling

A

SJF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which algorithm is the preemptive version of SJF?
A. Longest Remaining Time First
B. Round Robin
C. Shortest Remaining Time First
D. Priority Round Robin

A

Shortest Remaining Time First

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In Round Robin scheduling, what determines the time slice?
A. Process type
B. Process size
C. Time quantum
D. CPU load

A

Time quantum

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the disadvantage of having too small a time quantum in Round Robin?
A. Increases throughput
B. Increases context switching overhead
C. Increases response time
D. Reduces fairness

A

Increases context switching overhead

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

In priority scheduling, which number has the highest priority?
A. The largest integer
B. 0
C. The smallest integer
D. 100

A

The smallest integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is starvation in priority scheduling?
A. When all processes are terminated
B. When high-priority processes are delayed
C. When low-priority processes never execute
D. When threads run in parallel

A

When low-priority processes never execute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is the solution to starvation?
A. Fragmentation
B. Aging
C. Preemption
D. Multithreading

A

Aging

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Which scope involves competition among all system threads?
A. User contention scope
B. PCS
C. Kernel contention scope
D. LWP scope

A

Kernel contention scope

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Thread scheduling is typically done in:
A. Application-level only
B. User mode only
C. Kernel level
D. File system level

A

Kernel level

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Which of the following is a symmetric multiprocessing system?
A. One CPU controlling others
B. Only one thread per CPU
C. Each processor is self-scheduling
D. CPUs use different operating systems

A

Each processor is self-scheduling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is processor affinity?
A. A processor bonded to another
B. Thread preferring a certain processor
C. Random CPU assignment
D. Cache ignored when scheduling

A

Thread preferring a certain processor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Which type of affinity allows OS to keep a thread on a processor with no guarantee?
A. Hard affinity
B. Soft affinity
C. Sticky affinity
D. Load-based affinity

A

Soft affinity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is the goal of load balancing in multiprocessor systems?
A. Prioritize CPU-bound processes
B. Distribute workload evenly
C. Ignore cache contents
D. Reduce CPU usage

A

Distribute workload evenly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Which migration method lets idle CPUs request tasks from busy ones? A. Pull migration B. Push migration C. Active migration D. Lazy migration
Pull migration
26
What is a hard real-time system? A. Prioritizes real-time threads B. Tasks must complete by deadline C. Uses soft affinity D. Uses only one core
Tasks must complete by deadline
27
What does real-time scheduling rely on? A. FIFO B. FCFS C. Priority-based preemptive scheduling D. SJF
Priority-based preemptive scheduling
28
Which latency is time from interrupt to start of service routine? A. Response latency B. Dispatch latency C. Event latency D. Interrupt latency
Interrupt latency
29
n periodic tasks, what is the deadline requirement? A. d ≥ p ≥ t B. t ≤ d ≤ p C. p ≤ d ≤ t D. d ≤ t ≤ p
t ≤ d ≤ p
30
What is the Linux scheduler from version 2.6.23+? A. UNIX Scheduler B. Completely Fair Scheduler C. Round Robin Scheduler D. Realtime-only Scheduler
Completely Fair Scheduler
31
What does the Linux CFS scheduler use to determine scheduling? A. Burst time B. Virtual run time (vruntime) C. FIFO order D. CPU priority cache
Virtual run time (vruntime)
32
In Windows, which priority levels are for real-time threads? A. 1–15 B. 0 only C. 16–31 D. 32–63
16–31
33
What runs when no runnable thread exists in Windows? A. Kernel process B. Background manager C. Idle thread D. Low-priority task
Idle thread
34
What is the main reason for using synchronization tools? A. To increase CPU clock speed B. To control access to shared data and prevent race conditions C. To reduce power consumption D. To increase the number of threads
To control access to shared data and prevent race conditions
35
What is a race condition? A. A type of error during compilation B. When processes run in a specific order C. When several processes access shared data concurrently and the result depends on access order D. A method to prioritize threads
When several processes access shared data concurrently and the result depends on access order
36
What are the three requirements for solving the critical section problem? A. Atomicity, Liveness, and Safety B. Blocking, Fairness, and Deadlock C. Mutual Exclusion, Progress, and Bounded Waiting D. Deadlock, Livelock, and Starvation
Mutual Exclusion, Progress, and Bounded Waiting
37
Which of the following ensures mutual exclusion in critical sections? A. Sleep() function B. Lock-free memory C. Peterson’s Algorithm D. FIFO Queues
Peterson’s Algorithm
38
Which section of code checks if a process can enter its critical section? A. Exit section B. Remainder section C. Entry section D. Initialization section
Entry section
39
In Peterson’s solution, what does flag[i] = true indicate? A. Process Pi has exited B. Process Pi is idle C. Process Pi is ready to enter the critical section D. Process Pi is in the remainder section
Process Pi is ready to enter the critical section
40
Why might Peterson’s solution fail on modern architectures? A. Compilers are not compatible B. Load/store instructions are no longer atomic C. Modern processors may reorder instructions D. Multi-core CPUs do not allow synchronization
Modern processors may reorder instructions
41
What is a memory barrier used for? A. To stop multiple threads from starting B. To prevent cache corruption C. To ensure memory updates are visible to all processors D. To block all processes permanently
To ensure memory updates are visible to all processors
42
What is a key characteristic of a "spinlock"? A. Uses semaphores B. It avoids busy waiting C. Continuously checks a lock in a loop D. Requires priority inheritance
Continuously checks a lock in a loop
43
What is a key characteristic of a "spinlock"? A. Uses semaphores B. It avoids busy waiting C. Continuously checks a lock in a loop D. Requires priority inheritance
Continuously checks a lock in a loop
44
What is the function of wait(S) in semaphore? A. Increments S B. Decrements S if it's greater than 0 C. Deletes S D. Skips S
Decrements S if it's greater than 0
45
A binary semaphore differs from a counting semaphore because: A. It only allows values of 0 or 1 B. It uses floating-point operations C. It supports multilevel queues D. It increments only by 2
It only allows values of 0 or 1
46
What is the main issue with using busy waiting in semaphores? A. It requires a large memory B. It wastes CPU cycles C. It causes memory leaks D. It delays disk operations
It wastes CPU cycles
47
What is one solution to busy waiting in semaphore implementation? A. Mutex B. Cache syncing C. Block and Wakeup mechanisms D. Critical region nesting
Block and Wakeup mechanisms (✔)
48
What does the Bounded Buffer problem address? A. File storage in hard drives B. Sharing buffers between producer and consumer processes C. Memory management D. Kernel optimization
Sharing buffers between producer and consumer processes
49
In the Readers-Writers problem, multiple readers can: A. Never read at the same time B. Read concurrently if no writer is writing C. Read and write at the same time D. Only read in FIFO order
Read concurrently if no writer is writing (✔)
50
In the Dining Philosophers problem, each philosopher must: A. Hold one chopstick at all times B. Wait for both chopsticks before eating C. Talk before eating D. Pass chopsticks in a circle
Wait for both chopsticks before eating
51
What is liveness? A. Ensures that a system never halts B. Ensures processes eventually make progress C. Keeps all processes in a loop D. Makes systems run faster
Ensures processes eventually make progress
52
What is priority inversion? A. High-priority process demotes a low-priority process B. Low-priority process holds a resource needed by high-priority one C. Processes switch priorities randomly D. Causes threads to run backward
Low-priority process holds a resource needed by high-priority one
53
Which OS uses dispatcher objects like mutexes, semaphores, and events? A. Linux B. Unix C. Windows D. DOS
Windows
54
What replaced spinlocks in Linux on single-CPU systems? A. Reader-writer locks B. Kernel preemption disabling C. Interrupt handling D. Signal masks
Kernel preemption disabling
55
In Java, which feature is used for synchronization? A. Fork/Join B. Java Monitors C. JavaBeans D. HashMaps
Java Monitors
56
In Java, when a thread calls wait(), it: A. Immediately returns B. Acquires all locks C. Is placed in the object’s wait set D. Ends execution
57
What is a race condition? A. A type of hardware issue B. When processes access and manipulate shared data concurrently and outcome depends on order of access C. When a process is stuck in an infinite loop D. None of the above
When processes access and manipulate shared data concurrently and outcome depends on order of access
58
Why is process synchronization needed? A. To improve graphics B. To ensure processes finish faster C. To avoid race conditions and maintain data consistency D. To delay process execution
To avoid race conditions and maintain data consistency
59
What are cooperating processes? A. Processes that do not interact with each other B. Processes that share only memory C. Processes that can affect or be affected by other processes D. None of the above
Processes that can affect or be affected by other processes
60
Which of the following is NOT a requirement of the critical-section problem? A. Mutual Exclusion B. Memory Reuse C. Progress D. Bounded Waiting
Memory Reuse
61
Mutual exclusion means: A. Only one process can access its private section B. Only one process can enter the critical section at a time C. No process can access the critical section D. All processes can access the critical section simultaneously
Only one process can enter the critical section at a time
62
What is bounded waiting? A. Process waits for a fixed number of milliseconds B. Process waits indefinitely C. A limit exists on the number of times other processes can enter their CS before a request is granted D. None of the above
A limit exists on the number of times other processes can enter their CS before a request is granted
63
What does disabling interrupts achieve in uniprocessor systems? A. Allows multiple processes in CS B. Prevents memory access C. Ensures mutual exclusion D. Causes deadlock
Ensures mutual exclusion
64
What is a drawback of disabling interrupts for critical sections? A. High power consumption B. Starvation of processes C. Inefficient on multiprocessor systems D. Slows down file systems
Inefficient on multiprocessor systems
65
Peterson’s solution assumes: A. Non-atomic instructions B. Atomic load and store instructions C. Multiprocessor compatibility D. No shared memory
Atomic load and store instructions
66
Which two variables are used in Peterson’s solution? A. lock and key B. mutex and turn C. turn and flag[ ] D. entry and exit
turn and flag[ ]
67
Peterson’s solution satisfies: A. Only mutual exclusion B. Only progress C. All three CS requirements D. Only bounded waiting
All three CS requirements
68
Why might Peterson’s solution fail on modern systems? A. Because it uses too much memory B. Due to reordering by compilers and processors C. Because it is too simple D. It has infinite loops
Due to reordering by compilers and processors
69
What does a memory barrier do? A. Blocks memory allocation B. Resets the memory C. Ensures visibility of memory updates across processors D. Deletes memory cache
Ensures visibility of memory updates across processors
70
Which of the following is a hardware instruction for synchronization? A. push() B. test-and-set C. load-and-store D. get-variable
test-and-set
71
Atomic variables ensure: A. Concurrent writes B. Safe and uninterruptible operations C. Memory leak prevention D. Data compression
Safe and uninterruptible operations
72
Mutex locks use what technique? A. Condition variable B. Atomic acquire() and release() C. Loops only D. None
Atomic acquire() and release()
73
What is a spinlock? A. Lock that sleeps during wait B. Lock with timeout C. Lock that busy waits D. None of the above
Lock that busy waits
74
Which is NOT true about semaphores? A. Uses wait() and signal() B. wait() and signal() are atomic C. Cannot be implemented without busy waiting D. Can be binary or counting
Cannot be implemented without busy waiting
75
How is busy waiting avoided in semaphores? A. Using random delays B. Using waiting queues with block and wakeup C. Deleting processes D. Spinning loops
Using waiting queues with block and wakeup
76
Incorrect usage of semaphores can lead to: A. Hardware failure B. Deadlock and race conditions C. Memory errors D. Segmentation faults
Deadlock and race conditions
77
What is true about a monitor? A. Allows multiple processes to access simultaneously B. Used to monitor CPU temperature C. Allows only one active process at a time D. Used to manage hardware
Allows only one active process at a time
78
Which of the following is a liveness problem? A. Race condition B. Infinite recursion C. Starvation D. Synchronization
Starvation
79
Priority inversion happens when: A. High-priority process runs infinitely B. Lower-priority process blocks a higher-priority one by holding a resource C. Priorities change randomly D. None of the above
Lower-priority process blocks a higher-priority one by holding a resource
80
In the bounded-buffer problem, which semaphore tracks full slots? A. empty B. full C. mutex D. lock
full
81
In the readers-writers problem, which processes can read concurrently? A. Writers only B. Readers only C. Writers and Readers D. Neither
Readers only
82
Which problem describes starvation due to many readers? A. Second readers-writers B. Dining philosophers C. Bounded buffer D. First readers-writers
First readers-writers
83
In the dining-philosophers problem, each philosopher needs: A. One chopstick B. Two chopsticks C. Bowl of soup D. Spoon and fork
Two chopsticks
84
What does Windows use on multiprocessor systems for synchronization? A. Mutex only B. Semaphore queues C. Spinlocks D. Pipes
Semaphore queues
85
What are dispatcher objects in Windows used for? A. Printing data B. Memory management C. Represent mutexes, semaphores, events, timers D. File transfer
Represent mutexes, semaphores, events, timers
86
What type of semaphore does POSIX NOT support? A. Named B. Unnamed C. Counting D. Thread-safe only
Thread-safe only
87
In Java, what happens when a thread calls wait()? A. It enters runnable state B. It blocks and releases the lock C. It deletes the lock D. None of the above
It blocks and releases the lock
88
What is true about functional programming languages? A. Variables are mutable B. They use locks for synchronization C. Variables are immutable D. They support C-style concurrency
Variables are immutable
89
What is transactional memory used for? A. Traditional OS memory allocation B. Avoiding locks and simplifying synchronization C. Sending messages D. None of the above
Avoiding locks and simplifying synchronization
90
What are the only storage devices the CPU can access directly? A. Cache and Disk B. Registers and Main Memory C. Hard Drive and Cache D. RAM and SSD
Registers and Main Memory
91
What is the purpose of a base and limit register in memory management? A. To store user credentials B. To implement virtual memory C. To define a process’s logical address space D. To handle page faults
To define a process’s logical address space
92
Address binding that occurs during execution time requires: A. Compiler support B. Loader support C. Hardware support D. Linker support
Hardware support
93
Which of the following is a drawback of contiguous memory allocation? A. Complex page table structures B. Internal fragmentation C. External fragmentation D. Slower access time
External fragmentation
94
What is a “hole” in memory management? A. A gap in the CPU pipeline B. A block of available memory C. A corrupted memory area D. A space in cache memory
A block of available memory
95
Which strategy for allocating memory chooses the smallest hole that fits the process? A. First-fit B. Best-fit C. Worst-fit D. Last-fit
Best-fit
96
What technique is used to reduce external fragmentation? A. Paging B. Segmentation C. Compaction D. Thrashing
Compaction
97
Paging eliminates which of the following? A. Internal fragmentation B. External fragmentation C. Page faults D. Virtual addresses
External fragmentation
98
What is a page in paging? A. A large memory block B. A logical memory unit C. A cache line D. A stack frame
A logical memory unit
99
A page table is used to: A. Track CPU registers B. Translate logical to physical addresses C. Monitor disk usage D. Convert source code to machine code
Translate logical to physical addresses
100
What does the Translation Lookaside Buffer (TLB) store? A. Entire programs B. Logical addresses C. Frequently used page table entries D. I/O addresses
Frequently used page table entries
101
If the TLB hit ratio is 99% and memory access is 10ns, what is the approximate effective access time? A. 20 ns B. 10.1 ns C. 12 ns D. 15 ns
10.1 ns
102
A segment is: A. A fixed-size memory block B. A virtual memory address C. A logical unit like a function or array D. A section of cache memory
A logical unit like a function or array
103
What is the key difference between segmentation and paging? A. Segmentation uses TLB B. Segmentation supports user view of memory C. Paging uses symbolic addresses D. Segmentation is faster than paging
Segmentation supports user view of memory
104
Why is hierarchical paging used? A. To increase fragmentation B. To reduce the number of TLB entries C. To handle large logical address spaces D. To simplify address binding
To handle large logical address spaces
105
In a two-level paging system, the logical address is divided into: A. Page number and frame offset B. Page number and segment number C. Outer page, inner page, and offset D. Segment, offset, and index
Outer page, inner page, and offset
106
In an inverted page table, how many entries are maintained? A. One per virtual page B. One per process C. One per physical frame D. One per TLB entry
One per physical frame
107
A hashed page table is especially useful for: A. Small memory systems B. Paging to disk C. 64-bit address spaces D. Cache management
64-bit address spaces
108
What is “roll out, roll in” in memory management? A. A context-switching strategy B. A form of dynamic partitioning C. A priority-based swapping method D. A segmentation technique
A priority-based swapping method
109
What happens to a process during swapping? A. It gets deleted B. It is permanently stored in disk C. It is temporarily moved to a backing store D. It switches to kernel mode
It is temporarily moved to a backing store
110
Why is swapping not commonly used in mobile systems? A. Lack of OS support B. Flash memory has limited write cycles C. Paging is faster D. No external storage is available
Flash memory has limited write cycles