1) If it takes 100 ns to search TLB and 1000 ns to access main memory. On average 10 hits occur for every 100 references to TLB. What is the effective memory access time with two level page tables and TLB is ?
Ans:
(TLB access time + Main memory access time)*hit ratio + (TLB access time + 3*main memory access time)*miss ratio
(100 + 1000)0.1 + (100 + 3000)0.9 = 2900ns
==================================================================
Consider a system with byte-addressable memory, 32 bit logical addresses, 4 kilobyte page size and page table entries of 4 bytes each. The size of the page table in the system in megabytes is ___________
Ans:
Number of entries in page table = 232 / 4Kbyte
= 232 / 212
= 220
Size of page table = (No. page table entries)*(Size of an entry)
= 220 * 4 bytes
= 222
= 4 Megabytes
=========================================================================
1. Consider a machine with 64 MB physical memory and a 32-bit
virtual address space. If the page size is 4KB, what is the approximate
size of the page table? (GATE 2001)
(a) 16 MB
(b) 8 MB
(c) 2 MB
(d) 24 MB
Answer: (c)
Explanation:
A page entry is used to get address of physical memory. Here we assume
that single level of Paging is happening. So the resulting page table
will contain entries for all the pages of the Virtual address space.
Number of entries in page table =
(virtual address space size)/(page size)
Using above formula we can say that there will be 2^(32-12) = 2^20 entries in page table.
No. of bits required to address the 64MB Physical memory = 26.
So there will be 2^(26-12) = 2^14 page frames in the physical memory.
And page table needs to store the address of all these 2^14 page frames.
Therefore, each page table entry will contain 14 bits address of the
page frame and 1 bit for valid-invalid bit.
Since memory is byte addressable. So we take that each page table entry is 16 bits i.e. 2 bytes long.
Size of page table =
(total number of page table entries) *(size of a page table entry)
= (2^20 *2) = 2MB
==================================================================
1. Suppose the time to service a page fault is on the average
10 milliseconds, while a memory access takes 1 microsecond. Then a
99.99% hit ratio results in average memory access time of (GATE CS 2000)
(a) 1.9999 milliseconds
(b) 1 millisecond
(c) 9.999 microseconds
(d) 1.9999 microseconds
Answer: (d)
Explanation:
Average memory access time =
[(% of page miss)*(time to service a page fault) +
(% of page hit)*(memory access time)]/100
So, average memory access time in microseconds is.
(99.99*1 + 0.01*10*1000)/100 = (99.99+100)/1000 = 199.99/1000 =1.9999 µs
=================================================================
Deadlock :
- It is a processes which are suspended or blocked state and are not in ready or running state and are waiting for some resources.
Spin Lock :
- It is the condition where two or more processes are not in the deadlock state , one process is dispatched by the CPU scheduler for execution (i.e to enter the Critical Section) while the other process is held by the CS.
- Process P2 is in the running state and P1 is in the ready state and both of them are locked.
- Process P1 is inside the Critical Sections and wants the CPU in order to execute and come out of the Critical Section , and Process P2 will not give the CPU unless it enters into the Critical Section.
- Process P2 can’t enter the critical section due to the lock and Process P1 is preempted by the CPU.
=================================================================
Semaphores:
(a) Counting Semaphore:
- It is a structure variable with an integer counter and a queue as list.
- The Integer counter, which tells how many number of processes can be present in the Critical Section
- The queue contains the list of processes which are waiting to enter the critical section.
- Mutual Exclusion is not guaranteed since many processes can be present in the critical section at a time. But Mutual Exclusion can be achieved if the counter is set to 1.
(b) Binary Semaphore (or Mutex)
- It is used for Mutual Exclusion
- It has enum datatype which can take either 0 or 1 value.
- It similar to counting semaphore whose value is initialised to 1.
- Using Mutexes there is a chance of deadlock.
=================================================================
Linker:
- It generates the relocatable address
- It resolves the symbol table
Loader:
- It generates the absolute address from relocatable address.
=================================================================
No comments:
Post a Comment