Operating systems questions (35)
Operating systems questions (35)
youtube.com/watch?
v=E_p3f0Jckf8&list=PLh9ECzBB8tJO9eiwfQbcA2ThMbUSkbOWf&index=20
• When we do not know how much amount of memory would be needed for the
program beforehand.
• When we want data structures without any upper limit of memory space.
• When you want to use your memory space more e ciently.
• Dynamically created lists insertions and deletions can be done very easily just by the
manipulation of addresses whereas in the case of statically allocated memory
insertions and deletions lead to more movements and wastage of memory.
• When you want to use the concept of structures and linked lists in programming,
dynamic memory allocation is a must
17- A computer system supports 32-bit virtual addresses as well as 32-bit physical
addresses. Since the virtual address space is of the same size as the physical
address space, the operating system designers decide to get rid of the virtual
memory entirely. Which one of the following is true?
Answer: C) For supporting virtual memory, special hardware support is needed from
Memory Management Unit. Since operating syste m designers decide to get rid of the
virtual memory entirely, hardware support for memory management is no longer needed
18- A CPU generates 32-bit virtual addresses. The page size is 4 KB. The processor
has a translation look-aside bu er (TLB) which can hold a total of 128 page table
entries and is 4-way set associative. The minimum size of the TLB tag is?
A 11 bits
B 13 bits
C 15 bits
D 20 bits
Answer: C) Size of a page = 4KB = 2^12 Total number of bits needed to address a page
frame = 32 - 12 = 20 If there are 'n' cache lines
in a set, the cache placement is called n-way set associative. Since TLB is 4 way set
associative and can hold total 128 (2^7) page table entries, number of sets in cache =
2^7/4 = 2^5. So 5 bits are needed to address a set, and 15 (20 - 5) bits are needed for tag.
19- A multilevel page table is preferred in comparison to a single level page table for
translating virtual address to physical address because ?
It helps to reduce the size of page table needed to implement the virtual address space of
a process.The size of page table may become too big (See this) to t in contiguous space.
That is why page tables are typically divide d in levels.
fi
ff
fi
fi
fi
20-
21-
22- In a system with 32 bit virtual addresses and 1 KB page size, use of one-level
page tables for virtual to physical address translation is not practical because of
(GATE CS 2003)
a) the large amount of internal fragmentation
b) the large amount of external fragmentation
c) the large memory overhead in maintaining page tables
d) the large computation overhead in the translation process
Answer (c)
Since page size is too small it will make size of page tables huge.
23- The minimum number of page frames that must be allocated to a running
process in a virtual memory environment is determined by (GATE CS 2004)
a) the instruction set architecture
b) page size
c) physical memory size
d) number of processes in memory
Answer (a)
Each process needs minimum number of pages based on instruction set architecture.
Example IBM 370: 6 pages to handle MVC (storage to storage move) instruction
Instruction is 6 bytes, might span 2 pages.
2 pages to handle from.
2 pages to handle to.
24- Which of the following is NOT an advantage of using shared, dynamically linked
libraries as opposed to using statically linked libraries ?
A Smaller sizes of executable les
B Lesser overall page fault rate in the system
C Faster program startup
D Existing programs need not be re-linked to take advantage of newer versions of
libraries
Answer: C) Refer Static and Dynamic Libraries In Non-Shared (static) libraries, since
library code is connected at compile time, the nal executable has no dependencies on
the library at run time i.e. no additional run-time loading costs, it means that you don’t
need to carry along a copy of the library that is being used and you have everything under
your control and there is no dependency.
Multi-Level Page Table: Memory kullanımını optimize etmek için page table'ları birden fazla
seviyeye böler; böylece yalnızca gerekli page table bölümleri memory'de tutulur.
Inverted Page Table: Her process için ayrı bir page table tutmak yerine, tüm sistem için tek bir
page table kullanarak, memory frame'lerini process'lerle ilişkilendirir ve bu sayede memory'de
yerden tasarruf sağlar.
Hashed Page Table: Page table girişlerini daha hızlı bulmak için hashing kullanır, büyük address
space'lere sahip sistemlerde adres çevirisini hızlandırır.
26- What is used to modify the page-fault service routine to include page
replacement?
Victim Frame
29- Consider a logical address space of 2,048 pages with a 4-KB page size, mapped
onto a physical memory of 512 frames.
a. How many bits are required in the logical address? 23
b. How many bits are required in the physical address? 21
31- What is the copy-on-write feature, and under what circumstances is its use
bene cial? What hardware support is required to implement this feature?
Copy-on-write (COW), bir process tarafından kullanılan bir memory block'un başka bir
process ile paylaşıldığı durumlarda, yalnızca bir process bu block üzerinde değişiklik
yapmaya çalıştığında block'un kopyalanması prensibine dayanır. Bu özellik, özellikle
process creation sırasında parent ve child process'lerin aynı memory sayfalarını
paylaşarak memory kullanımını optimize etmesiyle faydalıdır.
Bu özelliğin uygulanabilmesi için, donanım desteği olarak page tables üzerinde write
protection bit'lerinin kullanılması gereklidir. Bu sayede, bir yazma girişimi sırasında page
fault oluşur ve işletim sistemi, ilgili memory sayfasının kopyalanmasını başlatır.