Explain LRU page replacement algorithm for following reference string. 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1 Calculate the page fault.

1 Answer

Answer :

LRU:

The Least Recently Used (LRU) page replacement policy replaces the page that has not been used for the longest period of time.

LRU replacement associates with each page the time of that page's last use.

When a page must be replaced, LRU chooses the page that has not been used for the longest period of time.

The LRU policy is often used as a page-replacement algorithm and is considered to be good.

An LRU page-replacement algorithm may require substantial hardware assistance.


Counters:

In the simplest case, we associate with each page-table entry a time-of-use field and add to the CPU a logical clock or counter.

The clock is incremented for every memory reference.

Whenever a reference to a page is made, the contents of the clock register are copied to the time-of-use field in the pagetable entry for that page.

In this way, we always have the "time" of the last reference to each page. We replace the page with the smallest time value.


Stack:

Another approach to implementing LRU replacement is to keep a stack of page numbers.

Whenever a page is referenced, it is removed from the stack and put on the top.

In this way, the most recently used page is always at the top of the stack and the least recently used page is always at the bottom.


Reference String: 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1

(Frame size have not mentioned in question so assume frame size as 3

or 4)

LRU: Assume frame size=3


image

Related questions

Description : Suppose that the virtual Address space has eight pages and physical memory with four page frames. If LRU page replacement algorithm is used, .............. number of page faults occur with the reference string. 0 2 1 3 5 4 6 3 7 4 7 3 3 5 5 3 1 1 1 7 2 3 4 1 (A) 11 (B) 12 (C) 10 (D) 9

Last Answer : (A) 11

Description : Consider a program that consists of 8 pages (from 0 to 7) and we have 4 page frames in the physical memory for the pages. The page reference string is :  1 2 3 2 5 6 3 4 6 3 7 3 1 5 3 6 3 4 2 4 3 4 5 ... to fill available page frames with pages): (A) 9 and 6 (B) 10 and 7 (C) 9 and 7 (D) 10 and 6

Last Answer : (B) 10 and 7

Description : A LRU page replacement is used with four page frames and eight pages. How many page faults will occur with the reference string 0172327103 if the four frames are initially empty? (A) 6 (B) 7 (C) 5 (D) 8

Last Answer : (B) 7

Description : Consider the reference string 0 1 2 3 0 1 4 0 1 2 3 4 If FIFO page replacement algorithm is used, then the number of page faults with three page frames and four page frames are .......... and ........... respectively. (A) 10, 9 (B) 9, 9 (C) 10, 10 (D) 9, 10

Last Answer : (D) 9, 10

Description : Explain Round Robin algorithm with suitable example.

Last Answer : It is preemptive scheduling algorithm. A small unit of time known as a time quantum or time slice is used for pre-emption of a currently running process. Ready queue is implemented as a circular ... has received 1 time quantum, the CPU returns to process P1 for an additional time quantum. 

Description : A job has four pages A, B, C, D and the main memory has two page frames only. The job needs to process its pages in following order: ABACABDBACD Assuming that a page interrupt occurs when a new page is brought in the main ... replacement algorithms are (A) 9 and 7 (B) 7 and 6 (C) 9 and 8 (D) 8 and 6

Last Answer : (C) 9 and 8

Description : Enlist different file allocation methods? Explain contiguous allocation method in detail.

Last Answer : From the user's point of view, a file is an abstract data type. It can be created, opened, written, read, closed and deleted without any real concern for its implementation. The implementation of a ... a times is difficult to estimate. 4. Compaction may be required and it can be very expensive.

Description : Explain multithreading model in detail.

Last Answer : Many systems provide support for both user and kernel threads, resulting in different multithreading models. Following are three multithreading model: Many-to-One Model The many-to- ... True concurrency cannot be achieved. Multiple threads of kernel is an overhead for operating system

Description : Enlist the operating system tools. Explain any two in detail.

Last Answer : Following are the operating tools: User Management Security policy Device Management Performance Monitor Task Scheduler A) User management: User management includes everything ... routing tables, interface statistics, masquerade connections, and multicast memberships. # netstat -tulpn

Description : Explain PCB with diagram.

Last Answer : Each process is represented as a process control block (PCB) in the operating system. It contains information associated with specific process. Process State: It indicates current state of a process. ... . Each PCB gives information about a particular process for which it is designed.

Description : Explain partitioning and its types.

Last Answer : An important operation of memory management is to bring programs into main memory for execution by the processor. Partitioning is a technique that divides a memory into multiple partitions. These partitions ... in memory. For example: Consider following table with process and memory space.

Description : Explain deadlock? What are necessary conditions for deadlock?

Last Answer : In multiprogramming environment, several processes may compete for a finite number of resources. A process requests resources and if the resources are not available then the process enters into the ... Each process is waiting for the resources held by other waiting processes in circular form.

Description : With neat diagram explain inter process communication model.

Last Answer : Inter-process communication: Cooperating processes require an Interprocess communication (IPC) mechanism that will allow them to exchange data and information. There are two models of IPC 1. ... a communication link between them. Between each pair of processes exactly one communication link.

Description : List components of OS. Explain process management in detail.

Last Answer : List of System Components: 1. Process management 2. Main memory management 3. File management 4. I/O system management 5. Secondary storage management Process Management: The operating ... synchronization. 4. A mechanism for process communication. 5. A mechanism for deadlock handling.

Description : Enlist types of operating system. Explain multiprogramming OS in detail.

Last Answer : Types of operating system 1.Batch Systems 2.Multiprogramming 3.Multitasking 4.Time-Sharing Systems 5.Desktop Systems 6.Distributed system 7.Clustered system 8.Real Time system: Multiprogramming ... multiprogramming: user can open word, excel, access and other applications in a system.

Description : Explain any four scheduling criteria.

Last Answer : 1. CPU utilization: In multiprogramming the main objective is to keep CPU as busy as possible. CPU utilization can range from 0 to 100 percent. 2.Throughput: It is the number of processes ... fairly early and can continue computing new results while previous results are being output to the user.

Description : Explain any 4 services provided by OS.

Last Answer : 1.User Interface: All operating systems have a user interface that allows users to communicate with the system. Three types of user interfaces are available: a. Command line interface ( ... to system resources. Security is provided by user authentication such as password for accessing information.

Description : List any four features of open source operating system.

Last Answer : 1. Open Source: open source OS code is freely available and it is community based development project. Multiple team's works in collaboration to enhance the capability of operating system and it is ... issuing a command in Linux Terminal or Shell. Linux can also run Windows applications if needed.

Description : List free space management techniques? Describe any one in detail.

Last Answer : A file system is responsible to allocate the free blocks to the file therefore it has to keep track of all the free blocks present in the disk. There are mainly four approaches by using which, the free ... block. This block contains a pointer to the next free disk block, and so on.

Description : State and describe types of scheduler.

Last Answer : There are three types of scheduler: Long term scheduler Short term scheduler Medium term scheduler 1. Long term scheduler: It selects programs from job pool and loads them into the ... scheduler works in close communication with long term scheduler for loading process into the main memory. 

Description : What is purpose of system call? State two system calls with their functions.

Last Answer : System call provides an interface between a running program and operating system. It allows user to access services provided by operating system. This system calls are procedures written using C, ... send, receive messages transfer status information attach or detach remote devices. 

Description : Write Unix command for following: i)create a folder OSY ii) create a file FIRST in OSY folder iii) List/display all files and directories. iv) Write command to clear the screen

Last Answer : i) create a folder OSY: $mkdir OSY ii)create a file FIRST in OSY folder: $cd OSY $cat>FIRST or $ touch FIRST iii) List/display all files and directories: $ls iv) to clear screen: $clear

Description : Describe sequential and direct access method.

Last Answer : Sequential access: Information from the file is processed in order i.e. one record after another. It is commonly used access mode. For example, editors and compilers access files in sequence. A read ... prevent the user from accessing portions of the file system that may not be part of his file.

Description : Describe I/O Burst and CPU Burst cycle with neat diagram.

Last Answer : CPU burst cycle: It is a time period when process is busy with CPU.  I/O burst cycle: It is a time period when process is busy in working with I/O resources. A process execution consists ... cycle and so on. The final CPU burst cycle ends with a system request to terminate execution.

Description : Describe any four file attributes

Last Answer : File attributes: Name: The symbolic file name is the only information kept in human readable form. Identifier: File system gives a unique tag or number that identifies file within file ... Last modification and last use. These data can be useful for protection, security and usage monitoring.

Description : Write syntax for following commands: i)Sleep ii)Kill

Last Answer : i)sleep Syntax: sleep NUMBER[SUFFIX]… sleep OPTION ii) kill Syntax: kill pid

Description : Define virtual memory

Last Answer : Virtual memory is a memory management capability of an operating system (OS) that uses hardware and software to allow a computer to compensate for physical memory shortages by temporarily transferring data ... can be placed in overlays, but can concentrate instead on the problem to be programmed. 

Description : Draw process state diagram.

Last Answer : process state diagram

Description : Define real time operating system. List its any four applications of it.

Last Answer : Real time Operating System: A real time system has well defined fixed time constraints. Processing should be done within the defined constraints -Hard and Soft real time system. OR The ... Applications: 1. Flight Control System 2. Simulations 3. Industrial control 4. Military applications

Description : What is LRU? Mention some of the LRUs in engine and airframe?

Last Answer : LRU or Line Replaceable Unit is a complex unit of the aircraft which can be quickly and easily removed while the aircraft is at bay or ramp area. It is a sealed unit designed for quick ... Valve. Some of the LRUs in airframe are all communication and navigation antennas, black box etc.

Description : Q No. 3: (a) How MMU is used to address the physical and logical cache arrangement Explain the difference between Least recently used and least frequently used replacement algorithm?

Last Answer : Q No. 3: (a) How MMU is used to address the physical and logical cache arrangement? Explain the difference between Least recently used and least frequently used replacement algorithm.

Description : Assume that a big part of the world would from now on begin with reading page 7 as opposed to page 1 from the Google Search results. How would that influence Google's algorithm/- search engine?

Last Answer : They would change the engine so that the best results started on page seven, while the first six pages are just filled with enough junk for the best results to be bumped to page seven. The algorithm wouldn’t change, just how they display the results.

Description : Quantitative attributes are A. A reference to the speed of an algorithm, which is quadratically dependent on the size of the data B. Attributes of a database table that can take only numerical values C. Tools designed to query a database D. None of these

Last Answer : B. Attributes of a database table that can take only numerical values

Description : Is String is Value Type or Reference Type in C#?

Last Answer : A string is an object(Reference Type).

Description : What goes into the algorithm Google Maps uses to calculate the suggested time of a given trip?

Last Answer : see @timtrueman ‘s answer to this thread http://www.fluther.com/82394/how-do-online-mapping-tools-calculate-best-distance-time/

Description : Write an algorithm to calculate the area of a circle and display the result . Use the formulae A=¶r where ¶ is equal to 3.1416?

Last Answer : 10001/999900

Description : A Page Fault occurs: a) When the Page is not in Memory b) When the Page is in the Memory c) When the process is in the ready state d) None of The Above

Last Answer : a) When the Page is not in Memory

Description : Let the page fault service time be 10 millisecond(ms) in a computer with average memory access time being 20 nanosecond(ns). If one page fault is generated for every 106 memory accesses, what is the effective access time for memory? (A) 21 ns (B) 23 ns (C) 30 ns (D) 35 ns

Last Answer : (C) 30 ns

Description : In a demand paging memory system, page table is held in registers. The time taken to service a page fault is 8 m.sec. if an empty frame is available or if the replaced page is not modified, and it takes 20 m.secs., if the replaced ... ? (A) 11.6 m.sec. (B) 16.4 m.sec. (C) 28 m.sec. (D) 14 m.sec.

Last Answer : (B) 16.4 m.sec. 

Description : Suppose that the number of instructions executed between page faults is directly proportional to the number of page frames allocated to a program. If the available memory is doubled, the mean interval between page faults is also ... memory were available? (A) 60 sec (B) 30 sec (C) 45 sec (D) 10 sec

Last Answer : Answer: C Explanation: T = Ninstr x 1µs + 15,000 x 2,000 µs = 60s Ninstr x 1µs = 60,000,000 µs - 30,000,000 µs = 30,000,000 µs Ninstr = 30,000,000 The number of instruction ... doesn't mean that the program runs twice as fast as on the first system. Here, the performance increase is of 25%.

Description : A virtual memory has a page size of 1K words. There are eight pages and four blocks. The associative memory page table contains the following entries:  Which of the following list of virtual addresses (in ... 1234, 4012, 5000, 6200 (C) 1020, 3012, 6120, 8100 (D) 2021, 4050, 5112, 7100

Last Answer : Answer: C Explanation: The pages which are not in main memory are: 1020 will not cause page fault (1024-2047) 3012 will not cause page fault (3072-4095) 6120 will not cause page fault (4096-5119) 8100 will not cause page fault (6144-7167)

Description : When does a Page fault occur? (1) There is an error in a specific page (2) A program accesses a page not currently in main memory (3) A program accesses a page of main memory (4) A program accesses a page belonging to another program

Last Answer : A program accesses a page not currently in main memory

Description : Which of the following is the correct name for Facebook's ranking algorithm? a. Face Rank b. Edge Rank c. Like Rank d. Page Rank

Last Answer : b. Edge Rank

Description : What is the name for Facebook`s ranking algorithm? A. Like Rank B. Face rank C. Page rank D. Edge rank

Last Answer : D. Edge rank

Description : What is the name for Facebook`s ranking algorithm? *  Like Rank  Face rank  Page rank  Edge rank

Last Answer :  Edge rank

Description : What is the name for Facebook`s ranking algorithm?  A. Edge rank  B. Page rank  C. Face rank  D. Like Rank

Last Answer : A. Edge rank

Description : Which of the following algorithm is used by Google to determine the importance of a particular page? a) SVD b) PageRank c) FastMap d) All of the mentioned

Last Answer : PageRank

Description : Which of the following algorithm is used by Google to determine the importance of a particular page? a) SVD b) PageRank c) FastMap d) All of the mentioned

Last Answer : PageRank

Description : Calculate the labour turnover rate according to replacement method from the following: No. of workers on the payroll: - At the beginning of the month: 500 - At the end of the month: 600 During the month, 5 workers left ... engaged for an expansion scheme. (a) 4.55% (b) 1.82% (c) 6% (d) 3%

Last Answer : (b) 1.82%