0% found this document useful (0 votes)
11 views

Operating systems questions (35)

The document provides an overview of memory management concepts, including paging, address binding, and virtual memory types. It discusses advantages and disadvantages of various memory management techniques, such as dynamic allocation and hashed-page tables, and explains phenomena like page faults and Belady's Anomaly. Additionally, it covers the differences between internal and external fragmentation, as well as the functionality of page tables and segment tables.

Uploaded by

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

Operating systems questions (35)

The document provides an overview of memory management concepts, including paging, address binding, and virtual memory types. It discusses advantages and disadvantages of various memory management techniques, such as dynamic allocation and hashed-page tables, and explains phenomena like page faults and Belady's Anomaly. Additionally, it covers the differences between internal and external fragmentation, as well as the functionality of page tables and segment tables.

Uploaded by

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

1- paging

youtube.com/watch?
v=E_p3f0Jckf8&list=PLh9ECzBB8tJO9eiwfQbcA2ThMbUSkbOWf&index=20

2- What is the basic advantage of Paging?


Paging reduces internal fragmentation and in paging there is a possibility of external
fragmentation.

3- What is the e ect of Paging?


Paging helps in improving the performance of the system by improving the utilization of
the memory and accessing the available memory present there.

4- What is the goal and functionality of memory management?


The goal and functionality of memory management are as follows;
• Relocation
• Protection
• Sharing
• Logical organization
• Physical organization
ff
5- Explain address binding?
The Association of program instruction and data to the actual physical memory locations
is called Address Binding.

6- Write di erent types of address binding?


Address Binding is divided into three types as follows.
Compile-time Address Binding
Load time Address Binding
Execution time Address Binding

7- Write an advantage of dynamic allocation algorithms?

• 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

8- What are the main types of virtual memory?


The main types of virtual memory are paging and segmentation. Paging divides memory
into xed-size pages, while segmentation divides memory into segments of di erent
sizes.

9- What is a page fault?


A page fault occurs when a program tries to access data that is not currently in RAM. The
operating system then retrieves the required page from the hard drive and loads it into
RAM.

10- De ne the Compaction?


The process of collecting fragments of available memory space into contiguous blocks by
moving programs and data in a computer’s memory or disk.

11- Write about the advantages and disadvantages of a hashed-page table?


Advantages
• The main advantage is synchronization.
• In many situations, hash tables turn out to be more e cient than search trees or any
other table lookup structure. For this reason, they are widely used in many kinds of
computer software, particularly for associative arrays, database indexing, caches,
and sets.
fi
fi
ff
ffi
ffi
ff
Disadvantages
• Hash collisions are practically unavoidable. when hashing a random subset of a large
set of possible keys.
• Hash tables become quite ine cient when there are many collisions.
• Hash table does not allow null values, like a hash map.
• De ne Compaction.

12- Write down the advantages of virtual memory?


• A higher degree of multiprogramming.
• Allocating memory is easy and cheap
• Eliminates external fragmentation
• Data (page frames) can be scattered all over the PM
• Pages are mapped appropriately anyway
• Large programs can be written, as the virtual space available is huge compared to
physical memory.
• Less I/O required leads to faster and easy swapping of processes.
• More physical memory is available, as programs are stored on virtual memory, so
they occupy very less space on actual physical memory.
• More e cient swapping

13- How to calculate performance in virtual memory?


The performance of virtual memory of a virtual memory management system depends on
the total number of page faults, which depend on “paging policies” and “frame
allocation”.
E ective access time = (1-p) x Memory access time + p x page fault time

14- What is Belady’s Anomaly?


Bélády’s anomaly is an anomaly with some page replacement policies increasing the
number of page frames resulting in an increase in the number of page faults. It occurs
when the First In First Out page replacement is used.

15- Disadvantages of Virtual Memory


• It can slow down the system performance, as data needs to be constantly
transferred between the physical memory and the hard disk.
• It can increase the risk of data loss or corruption, as data can be lost if the hard disk
fails or if there is a power outage while data is being transferred to or from the hard
disk.
• It can increase the complexity of the memory management system, as the operating
system needs to manage both physical and virtual memory.

16- Increasing the RAM of a computer typically improves performance because?


A Virtual memory increases
B Larger RAMs are faster
C Fewer page faults occur
D Fewer segmentation faults occur
ff
fi
ffi
ffi
Answer: C) When there is more RAM, there would be more mapped virtual pages in
physical memory, hence fewer page faults. A page f ault causes performance degradation
as the page has to be loaded from secondary device.

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?

A Ef cient implementation of multi-user support is no longer possible


B The processor cache organization can be made more ef cient now
C Hardware support for memory management is no longer needed
D CPU scheduling can be made more ef cient now

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.

25- Page Table types versusing.


Single-Level Page Table: Her process için basit bir array olarak yapılandırılmış olup, logical
address'i physical address'e doğrudan çevirir, ancak büyük memory ihtiyaçlarında büyük tablolara
neden olabilir.

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

27- Explain the difference between internal and external fragmentation.


Internal fragmentation: Bir process'e tahsis edilen memory block'un ihtiyaç duyulandan
büyük olması nedeniyle, bu block içindeki kullanılmayan alanların oluşmasıdır.
External fragmentation: Memory'de process'ler arasında küçük ve kullanılmayan
boşlukların oluşması nedeniyle yeterli boş alan olmasına rağmen contiguous memory
bulunamamasıdır.
fi
fi
28- What are the differences between Page Table and Segment Table?
Page table:
It contains the base address of each page in physical memory
The entries in page table are page number and corresponding frame number
Segment table:
It contains the segment address in physical memory.
The entries are segment base and segment limit

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

30- First- t Best- t Worse- t placement?


First: İlk gelene
Best: Yeteri kadar büyük olan boşlukların en küçüğüne
Worse: En büyük boşluğa

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.

32- What are the differences between pager and swapper?


Pager Swaps a page into memory when this page will be needed into memory.
It use in demand-paging system
Swapper swaps the entire processes into memory.
It uses in paging system
fi
fi
fi
fi
33- Code the semaphore operations

34- Page replacement exercise


35- Consider a user program of logical address of size 6 pages and page size is 4
bytes. The physical address contains 300 frames. The user program consists of
22 instructions a, b, c, . . . u, v . Each instruction takes 1 byte. Assume at that
time the free frames are 7, 26, 52, 20, 55, 6, 18, 21, 70, and 90.
Find the following? (10 degrees)
A) Draw the logical and physical maps and page tables?
B) Allocate each page in the corresponding frame?
C) Find the physical addresses for the instructions m, d, v, r?
D) Calculate the fragmentation if exist?

You might also like