0% found this document useful (0 votes)
14 views6 pages

Operating System Quiz

Quiz for course operating system

Uploaded by

fimraabdullah591
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Operating System Quiz

Quiz for course operating system

Uploaded by

fimraabdullah591
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Operating System Quiz-2

(Memory Virtualization)
DISCLAIMER: NOT ALL OF THE ANSWERS ARE CORRECT, AND I DO NOT KNOW WHICH ONES ARE
ACCURATE.

1. Which of these memory allocation functions are library calls similar to libc, not system
calls?

2. Which of these variants of malloc() prevents "uninitialized reads" from heap by zeroing
allocated memory before returning?
Answer: calloc()

3. So far, in memory virtualization, which of these assumptions have we not violated yet?
(Remember that we already have started paging after concluding segmentation!)
2nd
4. In software based relocation, the loader is limited as compared to hardware based
relocation because it suffers from the following weakness(es).

5. Jain's fairness index is a mathematical metric used to assess the fairness or equity of
resource allocation. Consider a memory virtualization system that has the requirement to
allocate memory for four processes. Process 1 (64 B), Process 2 (64 B), Process 3 (64
B), Process 4 (64B). What is the fairness in this case?
Answer: 1

ca. 1
6. For a process that is interested in discovering its segments locations (starting
addresses, of course), what would the process be able to see?

Virtual address

 Physical Addresses
 Virtual Addresses
7. Given that the sequence of code, heap and stack segments follows the typical ordering
in memory, for the following locations provided:
location of stack : 0x7fff691aea64
location of heap : 0x1096008c0
location of code : 0x1095afe50
Identify the correct option that can be used to determine size of code segment.
Answer: location of heap – location of code

8. To move a process’s address space, the OS has to __________________ the process.


Answer: Deshedule

9. Determine the physical address for the virtual address of 4096B in the physical location
of heap segment at 34 kBs, if the virtual base address of heap is at 4096B.

Physical base address of heap = 34KB = 34 × 1024 = 34816B

Virtual base address of heap = 4096B

Virtual address to translate = 4096B

Address Translation:
Physical address = Physical base address + (Virtual address – Virtual base address)
= 34816B + (4096B – 4096B)
= 34816B
10. Using segment registers, perform the address translation using virtual address of 4096B
in the physical location of heap segment at 34 kBs, if the virtual base address of heap is
at 4096B.
Use the following values:
SEG MASK: 0x3000
SEG SHIFT: 12
OFFSET MASK: 0xFFF

404 Answer Not Found

11. Code sharing as an option is exercised in the following software engineering


methodologies

12. (This question refers to the address translation within stack.)


Since the stack grows backwards, the example provided in the book says, "In this
example, assume we wish to access virtual address 15KB, which should map to physical
address 27KB. Our virtual address, in binary form, thus looks like this: 11 1100 0000
0000 (hex 0x3C00). The hard-ware uses the top two bits (11) to designate the segment,
but then we are left with an offset of 3KB. To obtain the correct negative offset, we must
subtract the maximum segment size from 3KB: in this example, a segment can be 4KB,
and thus the correct negative offset is 3KB - 4KB which equals -1KB. We simply add the
negative offset (-1KB) to the base (28KB) to arrive at the correct physical address:
27KB. The bounds check can be calculated by ensuring the absolute value of the
negative offset is less than the segment’s size."
Answer the following question: why the stack segment is identified using 11?

13. Referring to the question regarding address translation in stack segment, look at the
question carefully and identify one anomaly in there.
Answer: Likely incorrect offset calculation or misinterpretation of address bits.

Concept: Bounds checking and correct offset calculation are critical in address translation.

TO BE ANSWERED REGARDING PREVIOUS QUESTION

14. We know how allocated memory in heap can be used with free(). What problem do you
see if you do not use it for a short lived program and expect OS to do something upon
exit()?

Nswer: Memory will be reclaimed on exit().

Concept: The OS reclaims all memory used by a process upon termination, though not freeing it
can cause leaks during execution
15. In a time sharing system, if each process is given full access to all memory at runtime,
following problems could arise:

16. As we know that one major goal of virtualizing memory is achieving transparency.
Whom is it for?
Process

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy