Operating systems MCQ questions set 4 for competitive exams with answers explained
Operating
systems MCQ Set - 4
1.
Consider a disk with the following characteristics; Find the size of each sector of the given disk.
• Number
of surfaces: 8 (= 23)
• Number
of tracks / surface: 512 K (= 219)
• Number
of bytes / track: 8 MB (= 223 bytes)
• Number
of sectors / track: 8 K (= 213)
• On-disk
cache: 16 MB (= 224 bytes)
a.
1 KB
b.
2 KB
c. 4 KB
d. 8 KB
2.
Suppose you had a computer that supported virtual memory and had 32-bit virtual
addresses and 4KB (212 byte) pages. If a process actually uses 1024
(210) pages of its virtual address space, how much space would be
occupied by the page table for that process if a single-level page table was
used? Assume each page table entry occupies 4 bytes.
a. 2 MB
b. 4 MB
c. 8 MB
d. None of the above
Click here to view answer and explanation
Ans : (b)
Answer:
Number of pages
in the address space = 232/212 = 220 pages.
Therefore, a
single level page table would have 220 entries, where each entry
is 4 bytes. Therefore,
Space required by
the page table = 4 * 220 bytes = 4 MB.
This is
independent of how many pages are actually being used.
Step-by-Step Explanation
Suppose a computer supports virtual memory with 32-bit virtual addresses
and a page size of 4 KB (212 bytes).
A process actually uses 1024 (210) pages of its virtual address space.
Each page table entry occupies 4 bytes.
The system uses a single-level page table.
Given
- Virtual address size = 32 bits
- Page size = 4 KB = 212 bytes
- Pages actually used by process = 1024 pages = 210
- Page table entry (PTE) size = 4 bytes
- Page table type = Single-level page table
Step 1: Calculate the number of virtual pages
A 32-bit virtual address space provides:
232 bytes of virtual memory
Page size = 212 bytes
Number of virtual pages = 232 / 212 = 220 pages
Step 2: Understand single-level page table requirement
In a single-level page table, there must be one page table entry for
every virtual page, regardless of whether the process actually uses the page.
Step 3: Calculate page table size
Number of page table entries = 220
Size of each entry = 4 bytes
Page table size = 220 × 4 = 222 bytes
Step 4: Convert to megabytes
222 bytes = 4 MB
Final Answer
Correct Option: (b) 4 MB
|
3.
A CPU burst is
a. an example of priority
inversion where a low priority process gets access to the CPU.
b. a temporary increase in
the priority of a process to ensure that it gets the CPU.
c. an unexpected increase
in a process' need for computation.
d. the period of time that a process uses the processor between
I/O requests.
Click here to view answer and explanation
Ans : (d)
Answer:
CPU Burst and I/O Burst
In operating systems, a process does not use the CPU continuously.
Instead, its execution alternates between two phases:
-
CPU Burst → The process is actively executing
instructions on the CPU.
-
I/O Burst → The process is waiting for I/O operations
such as disk access, keyboard input, or network communication.
This cycle of CPU burst and I/O burst repeats until the process finishes execution.
A CPU burst is
the period of time that a process is executing instructions before it gets to
a waiting state on
some event (usually I/O but also things like messages or semaphores).
|
4.
Compared to a non-preemptive scheduler, a preemptive scheduler can move processes
from the:
a. running to the blocked state.
b. ready to the running state.
c. blocked to the ready state.
d. running to
the ready state.
Click here to view answer and explanation
Ans : (d)
Answer:
A preemptive
scheduler can stop a process from running and have
another process run.
More information
Process States
In an operating system, a process commonly moves among the following states:
- Ready → Waiting for CPU
- Running → Currently executing on the CPU
- Blocked (Waiting) → Waiting for I/O or some event
Difference Between Non-Preemptive and Preemptive Schedulers
Non-Preemptive Scheduler
- Once a process gets the CPU, it keeps it until:
- it finishes execution, or
- it voluntarily blocks for I/O
- The operating system cannot forcibly take the CPU away
Preemptive Scheduler
- The operating system can interrupt a running process
- The CPU can be taken away if:
- a higher-priority process arrives
- the time quantum expires (time-sharing systems)
Answer
A preemptive scheduler can move a process from the running state to the ready state. A running process is forced to give up CPU and placed back into the ready queue (not blocked).
Alternate question: Compared to a non-preemptive scheduler, what extra state transition is possible in a preemptive scheduler?
|
5.
The main advantage of DMA is that it
a. Increases the speed of
the CPU
b. Increases the speed of
the data bus
c. Increases the performance of the system by allowing more
things to happen at once
Click here to view answer and explanation
Ans : (c)
Answer:
What is DMA?
Direct Memory Access (DMA) is a hardware mechanism that allows
I/O devices (such as disks, network cards, etc.) to transfer data
directly to and from main memory without continuous involvement of the CPU.
The CPU:
- sets up the DMA transfer (source, destination, size)
- then is free to do other work while the transfer takes place
What Problem Does DMA Solve?
Without DMA
- The CPU must handle every byte or word transferred between the I/O device and memory
- This keeps the CPU busy and wastes valuable processing time
With DMA
- Data transfer happens in parallel with CPU execution
- The CPU and I/O devices can work simultaneously
Conclusion: Data transfer occurs independently of the CPU. CPU executes other processes at the same time. I/O and CPU work in parallel.
Because DMA enables parallel execution of: CPU computation and I/O data transfer. More tasks are completed in the same amount of time.
The main advantage of DMA is that it increases overall system performance by allowing the CPU and I/O operations to occur simultaneously.
|
********
No comments:
Post a Comment