Friday, April 24, 2020

Operating systems multiple choice questions for exams - Set 18

Operating systems exams - multiple choice questions (MCQ) and answers



Operating Systems MCQ questions and answers – Set 18

1. A memory management unit (MMU) is responsible for:

(a) Translating a process’ memory addresses to physical addresses
(b) Allocating kernel memory
(c) Allocating system memory to processes
(d) All of the above
View Answer

Answer: (a) Translating a process’ memory addresses to physical addresses        

The MMU is hardware that is part of the microprocessor. It translates from logical to physical memory locations.

More on MMU

A memory management unit translates addresses between the CPU and physical memory. This translation process is often known as memory mapping because addresses are mapped from a logical space into a physical space.
The memory management unit accepts logical addresses from the CPU. Logical addresses refer to the program's abstract address space but do not correspond to actual RAM locations. The MMU translates them from tables to physical addresses that do correspond to RAM.
The memory management unit (MMU) and associated page tables manage the translation between code, data, and heap process memory to the underlying physical memory.

2. A system uses 32-bit logical addresses, a 16K byte (214) page size, and 36-bit physical addresses (64 GB memory). What is the size of the page table?
(a) 218 page table entries
(b) 222 page table entries
(c) 214 page table entries
(d) 24 page table entries
View Answer

Answer: (a) 218 entries 
Given,
Logical address = 32 bits
Page size = 16 KB = 214 bytes
Therefore, number of bits required for page offset = 14
[Or, Page offset = log2(page size in bytes) = log2(214) = 14]
Number of bits in a page = Logical Address - Page Offset = 32 – 14 = 18 bits
Page table entries = 218 page table entries.
The physical memory address size does not required here.

3. During a context switch, the operating system ______

(a) Modifies some page table entries for the new process to reflect its memory map
(b) Switches a page table’s register to select a different page table
(c) Modifies the access permissions within the page table for the new process
(d) Leaves the page table untouched since it is a system-wide resource
View Answer

Answer: (b) Switches a page table register to select a different page table

Each process has its own page table.

During a context switch, the operating system sets the page table base register to the page table for that process.

A context switch between processes has nothing to do with swapping memory pages in and out. It simply sets the new process's CPU register context and sets the page directory to refer to the new process's page tables. The virtual memory manager is responsible for deciding when to swap pages in and out and updating the process's page tables to reflect that.

4. Which one of the following is an example of a hardware solution to the critical section problem?

(a) Banker’s algorithm
(b) Compare and Shop
(c) Test and Set
(d) Peterson’s algorithm
View Answer

Answer: (c) Test and Set   
Test and set is a hardware solution to the critical section problem.
  • Test and set is a hardware implementation for testing for the lock and resetting it to locked. If test shows unlocked, the process may proceed.
  • It acts as an atomic operation
  • It permits Busy waits, Spinning, and Spinlocks.
The other hardware solution is “compare and swap operation”.

5. When a process is created using the classical fork() system call, which of the following is NOT inherited by the child process?

(a) Process address space
(b) Process ID
(c) Open files
(d) Signal handlers
View Answer

Answer: (b) Process ID      
Child process has its own unique process ID. It will not inherit the process ID of parent.

What does the child process inherit from parent?

Environment settings, open file descriptors, signal handling settings, group IDs, memory mapped segments, current working directory, resource limits, controlling terminal, root directory etc.


*********

Related links:




OS Interview questions with answers

solved Interview questions in operating systems

GATE questions in operating systems

MCQ Interview questions in OS

Operating systems interview questions for competitive exams

objective type OS questions for IIT JEE entrance exam

No comments:

Post a Comment

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery