TCS Papers: Sample Questions 478 - 479 of 502

Examrace Placement Series prepares you for the toughest placement exams to top companies.

Question number: 478

» Basic CS » Operating System

Essay Question▾

Describe in Detail

Explain memory-mapped files


  • Memory-mapped files (MMFs) allow contents of a file to be mapped to logical address of an application.

  • Enable processes running on the same machine to share data with each other.

  • The MemoryMappedFile. CreateFromFile () method is used to obtain a MemoryMappedFile object that represents a persisted memory-mapped file from a file on disk.

  • These files are included in the System. IO. MemoryMappedFiles namespace containing four classes and three enumerations for accessing and securing mappings.

  • There are two types of memory-mapped files:

    • Persisted memory-mapped files

      • Associated with a source file on a disk.

      • When the last process has finished working with the file, the data is saved to the source file on the disk.

      • Suitable for working with extremely large source files.

    • Non-persisted memory-mapped files

  • Not associated with a file on a disk.

  • When the last process has finished working with the file, the data is lost and the file is reclaimed by garbage collection.

  • Suitable for creating shared memory for inter-process communications (IPC).

Memory mapped files

Memory Mapped Files

Given the image is define the memory mapped files

Question number: 479

» Basic CS » Operating System

Short Answer Question▾

Write in Short

what are demand-paging and pre-paging?


Table of Demand-paging and Pre-paging

Table of Demand-paging and Pre-paging



With demand paging, a page is brought into memory only when a location on that page is actually referenced during execution.

  • Pre-paging, pages other than the one demanded by a page fault are brought in.

  • The selection of such pages is done based on common access patterns, especially for secondary memory devices.

Pages swapped in on demand

Pages swapped in before use in anticipation.

More page faults (especially initially).

Reduce future page faults.

No wastage of page frames.

Pages may not be used (wastage of memory space).

No such overhead

Good strategies to pre-page (working set, contiguous pages, etc…).

demand-paging-the transfer of page from secondary memory toprimary memory at the moment of need.

pre-paging-the retrieval of a page other then demanded by apage fault. the hope is that the additional page will beneeded in near future.