Algorithm: Enhanced Second Chance Best Combination: Dirty Bit Is 0 and R Bit Is 0

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

List two methods for minimizing I/O request when servicing page faults?

1.modify/dirty bit
2.pooling device

Different between swapping and paging?

Swapping : operate an on entire image space in/out back store.


Paging : operate on one page at a time.

In regards to global and local page replacement policies,


1. Define global replacement?
Victimize a page from all page tables found in memory
2. Define Local replacement?
Victimize a page from the faulted process page table.
3. What is the major disadvantage of global replacement?
The pages from a process that is needed next may be victimized by other
process.

What is the purpose of the dirty bit?

minimizing I/O request when servicing page faults

What is the purpose of the reference bit?

It indicates whether or not the page has been called (referenced) recently

Which page replacement algorithm uses both dirty and reference bit combination to select
a victim page and what is the best combination?

Algorithm : enhanced second chance


best combination : dirty bit is 0 and R bit is 0
what is thrashing?

If number of frame allocated for a given process falls below minimum , the process
will forever faults
differentiate between external and internal fragmentation?

External : Cussed by continual arrival and departure of processes of different sizes.


Internal fragmentation : the cost of maintaining the left over hole if larger than the
hole itself.

List 3 different reasoning for using virtual memory?

1. Memory saving.
2. A process may lie in a none contiquous address space.
3. Pure Demand paging : can execute a prosses with zero pages loaded in RAM.
4. Demand paging : never load a page unless it needed.
5. Process may be loaded partially in RAM.
6. Paging system + lazy swapper.

Consider a paging system with a page table stored in memory that does not use virtual
memory.
if a memory reference takes 200 NS,
1. How long does a paged memory reference take?(answer in NS)
Paging system =200+200 =400 ns
2. What device O.S uses to speed up paged memory references?
TLB : Translation Look aside Buffer

What is meant by Belady’s anomaly?

If we increase the number of allocated frame this may increase page faults rate.

Differentiate between preemptive and non-preemptive multitasking?

Preemptive : a process will give up CPU willingly wherever it’s be asked for.

non-preemptive : a process would never gives up the CPU unless it does an I/O
request or terminated.
A computer has 4096 byte of memory and a page size of 16 bytes.
1. How many frames are there in main memory?
4096 byte = 212
16 = 24
#frames = 212/24 = 28
2. On the average, how much memory is lost to internal fragmentation per process?
Using paging system at least one
3. What is the maximum number of entries in a process page table?
28 of entries
4. How many bits are used to represent the page number?
4 bit
5. How many bits are used to represent the offset number?
8 bit

what is the physical 4 23 address of :

Given a page size of 128 bytes and the following 1 11 5 3 4 5 page


table ?

Page 4 : get frame = 4


4 * 128 + 23
4 * 27 + 23
4 >> 7 + 23

Given the following page reference string


00602022336 05631520
and a memory size of four frames, list the pages that would be expelled from memory:
1. LRU
0623 get : 5
0653 get : 1
1653 get : 2
1253 get : 0
1250

2. FIFO
0623 get : 5
6235 get : 1
2351 get : 0
3510

3. Optimal/Max
0623 get : 5
5623 get : 1
5123 get : 0
1230
Regarding RR scheduling algorithm, In What way a process gets affected if it has two
entries inside the ready Queue?

Select the process twin , such that the process finished it’s job fast.

What is meant when a process is in a spin lock state? How can it be solved?

Spain lock : continuously testing the semaphore to been unlock.


Semaphore list: A pointer to a link list that have all processes waiting for this
semaphore to be unlocked.

List two methods to solve/overcome external fragmentation problem?

1. Compaction.
2. Paging system.

Why is it that a lazy swapper is faster than swapper is?

operate on one page at a time.

For what reason(s) we attach a dirty bit to process page table entries?

We minimize number of I/O request when page faulted is running.


Detect whether the related frame in the ram is same as in paging device.

When and why does a page fault occur?

When : valid bit is zero.


Why : Because a page is needed but not loaded.

List three methods used for data synchronization access?

1. Critical section
2. Critical region
3. Semaphore
4. Monitors
computer has 245 byte of physical memory and a page size of 256 bytes that uses a paging system
with
a page table stored in memory with a TLB hardware support. If a memory reference takes 200
NS with
a TLB hit ratio of 80% and an TLB access time of 15 NS.

Answer The following Questions based on the above given information.


RAM = 245
Page size 256 = 28
1. Physical memory is divided into this many___245/28 = 237_____ frames.

2. Logical memory is divided into this many ____237____ pages.

3. Frame size is __256____ bytes.

4. On the average, this many ____0___ frames are lost due to external fragmentation per
process.

5. On the average, this many ____At less than one page___ frames are lost due to internal
fragmentation per process.

6. The maximum number of entries in a process page table is ____237___.

7. ___37___ bits are used to represent the page number.

8. ___8____bits are used to represent the offset number.

9. It takes __(15+200)*0.80 +_(15+15+200+200)*0.20__ NS to access main memory with TLB


support.

10. It takes ___200+200 =400____ NS to access main memory without TLB support.

11. It takes ___200____ NS to access main memory without using page system support.

12. ___MMU____unit is responsible for translating logical address to physical addresses.

13. ____FIFO____ algorithm suffers from belady’s anomaly .

14. ___SJF_____ Scheduling algorithm produces the smallest average wait time.

15. A process waiting on a semaphore to be cleared, it is placed on this __ready_____ queue.

16. An address binding of ___compile_______ time requires a special hardware.

17. An address binding of ____load______ and ____run______ have both logical and
physical address the same

18. According to 50% rule, if 140 blocks of memory have been allocated for
processes, a total number of blocks lost to external is _140/2 = 70_ blocks.
Consider the following 4 processes that need 25, 50, 100, 75 frames to run on a system that
has 200 free
frames. How many frames initially would be allocated for each process under

1. Equal allocation policy.


200 / 4 = 50 Frame
P1 = 25 gests 50
P2 = 50 gets 50
P3 = 100 gets 50
P4 = 75 gets 50

2. Proportional allocation policy.


200 Frames (Free) needed = 25 + 50 + 100 + 75 = 250 Frames
P1 = 200 / 250 * 50 = 40 Frames
P2 = 200 / 250 * 25 = 20 Frames
P3 = 200 / 250 * 100 = 80 Frames
P4 = 200 / 250 * 75 = 60 Frames

List three reasons why compaction is not a good solution to external fragmentation problem?
1. Allows a program to constraint and not to worry about how large it gets
2. All process that I want to lunch must be copied to paging device
3. If a process in not loaded in RAM → page it in
4. Program larger than physical memory can be loaded in RAM

What is meant by 50-percent rule?

N/2 Blocks are lost Due to external fragmentation

A computer has four page frames. The time of loading, time of last access, and the R and M
bits for each
page are shown below (the times are in clock ticks)

Page Time Last R M


Loaded referenc
ed
0 126 279 0 0
1 230 260 1 0
2 120 272 1 1
3 160 280 1 1

a. Which page will FIFO replace? Page 2


b. Which page will LRU replace? Page 1
c. Which page will second chance replace? Page 0
What does mean when the reference is bit is off?

has not been reference recently.

What does mean when the dirty bit is on?

Page that in ram difference than in paging device

Explain the working of the following allocation algorithms?


1. First Fit.
select the first hole that is larger than the process size itself

2. Best Fit.
select a hole that is larger than the process size but the difference between
two size is the smallest.
3. Worst Fit.
select a hole that is the largest.

List three reasons why compaction is not a good solution to external fragmentation
problem?
1. Some process can’t be moved if their address binding is compile or load time.
2. This operation is CPU expensive.
3. Do not know which direction to move.

What is the main reason(s) for attatching the following bits to a give page table?

1. Dirty/Modify Bit: minimize number of I/O request to service a victimized page.

2. Invalid/Valid Bit: indicate page loaded or not.

3. Reference Bits: indicate page is used or not.

Why to do choose page size to be power of 2’s?


For what reason(s) to do we go and try to select a victim page?

What Data structure used by O.S to keep track of multiple I/O requests to multiple devices
concurrently?
Table.

List 2 methods used for eliminating external fragmentation?

1. Compaction.
2. Paging System.

List three methods of address bindings?

1. Compile time
2. Load time
3. Run-time

According to 50% rule, if 38 blocks of memory have been allocated, how many blocks are
to external fragmentation?

N/2 = 38/2 = 19

You might also like