O.S. UNIT 5 (QUES/ANS)

 use at your own risk>>>mam ke agge mera naam mat le dean


1 >>what is virtual memory concept write the advantage virtual memory in a computer system.? 

Virtual memory is a common technique used in a computer's operating system (OS). Virtual memory uses both hardware and software to enable a computer

 to compensate for physical memory shortages, temporarily transferring data from random access memory (RAM) to disk storage.

**Virtual memory helps to gain speed when only a particular segment of the program is required for the execution of the program.

**It is very helpful in implementing a multiprogramming environment.

**It allows you to run more applications at once.

**It helps you to fit many large programs into smaller programs.

**Common data or code may be shared between memory.


2>>  explain demand paging write the steps of demand paging?

Demand paging is a process in which data is moved from secondary memory to RAM on a demand basis, which means all data is not stored in the main memory because the space is limited in RAM.

When a process tries to access a page, the following steps are generally followed:

  • Attempt to access page.
  • If page is valid (in memory) then continue processing instruction as normal.
  • If page is invalid then a page-fault trap occurs.
  • Check if the memory reference is a valid reference to a location on secondary memory. If not, the process is terminated (illegal memory access). Otherwise, we have to page in the required page.
  • Schedule disk operation to read the desired page into main memory.
  • Restart the instruction that was interrupted by the operating system trap.


Q3.describe the page fault in OS? 

Page Fault: A page fault happens when a running program accesses a memory page that is mapped into the virtual address space but not loaded in physical memory. Since actual physical memory is much smaller than virtual memory, page faults happen


Q.4 what is page replacement algorithm

 In case of a page fault, Operating System might have to replace one of the existing pages with the newly needed page. Different page replacement algorithms

 suggest different ways to decide which page to replace.

Page Replacement Algorithms: 

//inn mein diagram hai

1. First In First Out (FIFO): This is the simplest page replacement algorithm. In this algorithm, the operating system keeps track of all pages in the memory 

in a queue, the oldest page is in the front of the queue. When a page needs to be replaced page in the front of the queue is selected for removal. 

2. Optimal Page replacement: In this algorithm, pages are replaced which would not be used for the longest duration of time in the future. 


3. Least Recently Used: In this algorithm, page will be replaced which is least recently used. 



Q5.what is threshing write the advantage and disadvantage of threshing?

Thrashing is when the page fault and swapping happens very frequently at a higher rate, 

and then the operating system has to spend more time swapping these pages. This state in the operating system is known as thrashing. 

Because of thrashing, the CPU utilization is going to be reduced or negligible.


//ek diagram hai //advantages or disadvantages??


Comments

Popular posts from this blog

O.S. MIDSEM by god

MINI project format >> 1st sem