Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Operating System Expert

Processes have valid and invalid entries on their page tables. The valid entries all point to some where "real" (e.g. a physical page, or some portion of disk in case of non-resident pages, etc). The entries that don't point anywhere are the entries that we will use when allocating a new page.

The allocation of new pages can be done in two ways: either via sbrk(), or via mmap(). If you want to increase the size of the heap (i.e. the number of valid pages), you can use sbrk().

Using mmap(), on the other hand, maps a ?le into a process' virtual address space. In the allocator you implemented, for example, you used mmap() to map memory addresses to the ?le /dev/zero. This makes it seem like you were allocating space from /dev/zero each time you called mmap(). (Remember that whenever you read something from /dev/zero, you get only zeroes for as long as you want to keep reading.) But, since /dev/zero is a read-only ?le and we usually call mmap() using the MAP PRIVATE ?ag, we follow the COW rules. When you actually try to write to the memory mmap()'d from /dev/zero, the OS intervenes and clones the corresponding page. So, instead of actually writing to /dev/zero, you end up writing to a new memory page.

Now suppose you mmap 3 pages to /dev/zero. Right after you do this, the process' page table contains three mappings to /dev/zero. These are all COW mappings to a same single page in memory, which itself maps to /dev/zero3. However, the ?rst time some of these pages is modi?ed, a new page is created, and the corresponding mapping in one of the page tables is modi?ed. Notice that we could have used mmap with any other ?le instead of /dev/zero; say, an MP3 ?le.

In this case, whenever we mmap'd, we would be actually mapping memory addresses to portions of the MP3 ?le. If we then tried to write to those areas of memory, we would be indirectly over writing the ?le! Notice, however, that we could be careful enough and used the mmap parameter MAP PRIVATE; then, we would still be able to read from the MP3 ?le, but all writings to it would be done using Copy On Write.

Operating System, Computer Science

  • Category:- Operating System
  • Reference No.:- M9527952

Have any Question?


Related Questions in Operating System

Research types of operating systems that are currently

Research types of operating systems that are currently available and provide a scenario in which the operating system you chose would be appropriate to be used in this situation. Explain why you think the choice you made ...

Show all stepssuppose that the following processes arrive

Show all steps Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. in answering the questions, use non-preemptive scheduling and base all dec ...

Question what do you see as the major differences between

Question : What do you see as the major differences between UNIX/Linux and other operating systems, such as Windows and Mac OS X? The response must be typed, single spaced, must be in times new roman font (size 12) and m ...

Catalog course descriptionin this course students carry out

Catalog Course Description In this course students carry out independent research in a significant technical area of information, network, and computer security. The student is to investigate a technical area, research i ...

State the required answer precisely and then provide proper

State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. Consider a computer embedded in the control of a manned spacecraft. Would it require an ...

Question students working at individual pcs in a computer

Question : Students working at individual PC's in a computer laboratory send their files to be printed by a server that spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for ...

Question you are a security administrator responsible for

Question: You are a security administrator responsible for providing secure configuration requirements for new laptop deployments. After reading Module 2 of Certified Secure Computer User v2exercises, apply the configura ...

Question research hex editors available for mac os and

Question : Research hex editors available for Mac OS and Linux. Based on the documentation, how easy would validating these tools be? Select at least two hex editors for each OS, and discuss what you would do to validate ...

Taskyour job in this assignment is to create two virtual

Task Your job in this assignment is to create two Virtual machines each running a different but the latest distribution of Linux e.g. Ubuntu Server and CentOS. Each of these VM's is to offer services to a user base. The ...

Discussion question this research assignment will give

Discussion Question : This research assignment will give further information on the nature and workings of multi-tasking and multi-processing operating systems. All information reported in this assignment is to be in the ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As