CS#7201(Advanced(Opera3ng( Systems(

Instructor: Awais Qasim!

Memory Management

Review •  •  •  •  • 

Contiguous Memory Allocation (fixed-sized partitions, MVT) Best Fit, Worst Fit, First Fit Fragmentation (Internal and External) Paging Hardware Support (Set of dedicated registers, PTBR, TLB)

Protection in Paging •  Memory protection in a paged environment is accomplished by protection bits associated with each frame. •  Normally, these bits are kept in the page table. •  A bit defines a page to be read-write or read-only. •  Every reference to memory is checked to verify that no writes are being made to a read-only page. •  An attempt to write to a read-only page causes a hardware trap to the operating system (or memory-protection violation).

Protection in Paging(cntd) •  A valid-invalid bit is generally attached to each entry in the page table. •  When this bit is set to "valid," the associated page is in the process's logical address space and is thus a legal (or valid) page. •  When the bit is set to "invalid" the page is not in the process's logical address space. •  Illegal addresses are trapped by use of the valid-invalid bit. •  The operating system sets this bit for each page to allow or disallow access to the page.

Protection in Paging(cntd) •  In a system with a 14-bit address space (0 to 16383), if we have a program that should use only addresses 0 to 10468. •  Given a page size of 2 KB, addresses in pages 0,1, 2,3, 4, and 5 are mapped normally through the page table. •  Any attempt to generate an address in pages 6 or 7, however, will find that the valid-invalid bit is set to invalid, and the computer will trap to the operating system (invalid page reference).

Valid (v) or Invalid (i) Bit In A Page Table

Problem •  This scheme has a problem that although the program extends to 10468, accesses to addresses up to 12287 are valid. •  Only the addresses from 12288 to 16383 are invalid. •  This problem is a result of the 2-KB page size and reflects the internal fragmentation of paging.

Shared Pages •  An advantage of paging is the possibility of sharing common code. •  Consider a system with 40 users, each of whom executes a text editor. •  If the text editor consists of 150 KB of code and 50 KB of data space, we need 8,000 KB to support the 40 users. •  If the code is reentrant code (or pure code), however, it can be shared. Reentrant code is non-self-modifying code; it never changes during execution. •  Here we see a three-page editor—each page 50 KB in size being shared among three processes. Each process has its own data page.

Shared Pages(cntd) •  Thus, two or more processes can execute the same code at the same time. •  Each process has its own copy of registers and data storage to hold the data for the process's execution. •  Only one copy of the editor need be kept in physical memory. Each user’s page table maps onto the same physical copy of the editor, but data pages are mapped onto different frames. •  Now to support 40 users, we need only one copy of the editor (150 KB), plus 40 copies of the 50 KB of data space per user. •  The total space required is now 2,150 KB instead of 8,000 KB—a significant savings.

Shared Pages(cntd)

Page Table Structure •  Hierarchical Paging •  Hashed Page Tables •  Inverted Page Tables

Hierarchical Page Tables •  Most modern computer systems support a large logical address space (232 to 264). Hence the page table itself becomes excessively large. •  For example, consider a system with a 32-bit logical address space. If the page size in such a system is 4 KB (212), then a page table may consist of up to 1 million entries (232/212). •  Assuming that each entry consists of 4 bytes, each process may need up to 4 MB of physical address space for the page table alone. •  Clearly, we would not want to allocate the page table contiguously in main memory. •  One simple solution to this problem is to divide the page table into smaller pieces. •  A simple technique is a two-level page table

Two-Level Paging Example •  A logical address (on 32-bit machine with 4K page size) is divided into: –  a page number consisting of 20 bits –  a page offset consisting of 12 bits •  Since the page table is paged, the page number is further divided into: –  a 10-bit page number –  a 10-bit page offset •  Thus, a logical address is as follows:

where pi is an index into the outer page table, and p2 is the displacement within the page of the outer page table

Two-Level Paging Example

Address-Translation Scheme

Hierarchical Page Tables(cntd) •  This scheme is also known as a forward-mapped page table because address translation works from the outer page table inward. •  For a system with a 64-bit logical-address space, a two-level paging scheme is no longer appropriate. •  Suppose that the page size in such a system, is 4 KB (212). In this case, the page table consists of up to 252 entries (without hierarchical paging). •  If we use a two-level paging scheme, then the inner page tables can conveniently be one page long, or contain 210 4-byte entries.

Hierarchical Page Tables(cntd) •  The outer page table consists of 242 entries. Still too much entries. •  The obvious way to avoid such a large table is to divide the outer page table into smaller pieces.

•  The outer page table still has 232 entries. The next step would, be a four-level paging scheme, where the second level outer page table itself is also paged.

•  For 64-bit architectures, hierarchical page tables are generally considered inappropriate due to prohibitive number of memory accesses—to translate each logical address.

Hashed Page Tables •  A common approach for handling address spaces larger than 32 bits is to use a hashed page table, with the hash value being the virtual page number. •  Each entry in the hash table contains a linked list of elements that hash to the same location (to handle collisions). •  Each element consists of three fields: 1.  the virtual page number 2.  the value of the mapped page frame 3.  a pointer to the next element in the linked list.

•  The algorithm works as follows: 1.  The virtual page number in the virtual address is hashed into the hash table. 2.  The virtual page number is compared with field 1 in the first element in the linked list.

Hashed Page Tables(cntd) •  If there is a match, the corresponding page frame (field 2) is used to form the desired physical address. •  If there is no match, subsequent entries in the linked list are searched for a matching virtual page number.

Hashed Page Tables(cntd)

Inverted Page Tables •  Usually, each process has an associated page table. These tables may consume large amounts of physical memory just to keep track of how other physical memory is being used. •  To solve this problem, we can use an inverted page table. •  An inverted page table has one entry for each frame of memory. •  Each entry consists of the virtual address of the page stored in that real memory location, with information about the process that owns that page. •  Thus, only one page table is in the system, and it has only one entry for each frame of physical memory.

Inverted Page Tables (cntd) •  Storing the address-space identifier ensures that a logical page for a particular process is mapped to the corresponding physical page frame. •  This scheme increases the amount of time needed to search the table when a page reference occurs. •  The whole table might need to be searched for a match. •  To alleviate this problem, we use a hash table to limit the search to one—or at most a few—page-table entries. •  Systems that use inverted page tables have difficulty implementing shared memory. •  •  Shared memory is usually implemented as multiple virtual addresses that are mapped to one physical address. This standard method cannot be used with inverted page tables.

Inverted Page Table Architecture

Lecture 13-14.pdf

to the operating system (or memory-protection violation). Page 4 of 24. Lecture 13-14.pdf. Lecture 13-14.pdf. Open. Extract. Open with. Sign In. Main menu.

448KB Sizes 0 Downloads 152 Views

Recommend Documents

Lecture 7
Nov 22, 2016 - Faculty of Computer and Information Sciences. Ain Shams University ... A into two subsequences A0 and A1 such that all the elements in A0 are ... In this example, once the list has been partitioned around the pivot, each sublist .....

LECTURE - CHECKLIST
Consider hardware available for visual aids - Computer/ Laptop, LCD ... Decide timing- 65 minutes for lecture and 10 minutes for questions and answers.

Lecture 3
Oct 11, 2016 - request to the time the data is available at the ... If you want to fight big fires, you want high ... On the above architecture, consider the problem.

pdf-1490\record-of-agard-lecture-series-lecture ...
... the apps below to open or edit this item. pdf-1490\record-of-agard-lecture-series-lecture-series-i ... unne-j-c-north-atlantic-treaty-organization-vannucci.pdf.

Lectures / Lecture 4
Mar 1, 2010 - Exam 1 is next week during normal lecture hours. You'll find resources to help you prepare for the exam, which will be comprehensive, on the.

Prize Lecture slides
Dec 8, 2011 - Statistical Model for government surplus net-of interest st st = ∞. ∑ ... +R. −1 bt+1,t ≥ 0. Iterating backward bt = − t−1. ∑ j=0. Rj+1st+j−1 + Rtb0.

Lecture Note_Spectrophotometry.pdf
Aug 18, 2016 - ... rival UV‐Visible spectrometry. for its simplicity simplicity, versatility versatility, speed, accuracy accuracy and. cost‐effectiveness. Page 1 of 34 ...

Lecture 9
Feb 15, 2016 - ideological content have persisted among the American public from 1987 to 2012.2 ... That is, learning is social and takes place within the individuals' ... independent network structures, deriving always consensus results.

Lectures / Lecture 4
Mar 1, 2010 - course website. After lecture today, there will also be a review section. • Assignments are graded on a /–, /, /+ basis whereas exams are graded.

Lectures / Lecture 7
Apr 5, 2010 - Contents. 1 Introduction (0:00–5:00). 2. 2 Security (5:00–112:00). 2 .... use it to distribute pornography, you don't have to pay for disk space or bandwidth, but you might make money off ... requests—the more of a threat you pose

Inaugural lecture
Jan 31, 2001 - Contemporary global capitalism results from interactions between economics, finance, and technology. Any number of ... the form of software, but in the creation of images, and symbols. You could view it as a .... formal structures, rul

Frederick Sanger - Nobel Lecture
and hence the number of amino acid residues present. Values varying from ... In order to study in more detail the free amino groups of insulin and other proteins, a general ... disulphide bridges of cystine residues. Insulin is relatively rich in ...

Lecture Capture - USFSM
Step 2 on the Crestron: Touch the Lecture Capture Mode to turn on the projector and camera. Page 2. Step 3 on the Crestron Choose Podium PC. Now you will see your desktop on the projector. Panopto. Step 1 Log in to myUSF. Page 3. Step 2 Launch Canvas

Lecture 1 - GitHub
Jan 9, 2018 - We will put special emphasis on learning to use certain tools common to companies which actually do data ... Class time will consist of a combination of lecture, discussion, questions and answers, and problem solving, .... After this da

Lecture(PDF)
Structured programming uses an approach whichistop down,. OOPuses an ... anyshape it get rotated clockwise 360 degree and a soundis also played.

Inquisitive semantics lecture notes
Jun 25, 2012 - reformulated as a recursive definition of the set |ϕ|g of models over a domain. D in which ϕ is true relative to an assignment g. The inductive ...

Lecture 1
Introduction to object oriented programming. • The C++ primitive data types (int, float, double, char, etc) can be used by declaring a variable and assigning a value to it. • Consider creating your own data type, a variable of which can hold mult

Lecture 02
Engr. Syed Rizwan Ali, MS(CAAD) UK,. PDG(CS) UK, PGD (PM) IR, BS (BCE) PK. HEC Certified – Master Trainer (MT-FPDP). Computer Sciences Department.

Lecture: 10
Create a class Circle derived from Point class. Apart from data of Point class circle should store its radius. W rite constructor and appropriate methods .

Lecture(PDF)
Use java.io package and throWS Exception. ... jaVa. ENProgram Filles NuJava Nijdk1.6.0_11NbinXjava Comments ... proce&&Or &Cheduling.memory J83ge.

Lectures / Lecture 7
Apr 5, 2010 - Next we might try passing a phrase like “DELETE FROM ... your hard drive. This is why you should never open attachments from sources you don't trust! • Worms are more insidious because they don't require user interaction in order to

Lecture Ludhiana - Al Islam
Publishers' Note. Lecture Ludhiana is the lecture delivered by Hadrat. Mirza Ghulam Ahmad, the Promised Messiah and. Mahdi, (1835-1908), on 4 November ...

Lecture Contents
May 12, 2012 - 3. Structure data type. Dr. Amal Khalifa, 2012. 5. Structure data Types. Dr. Amal Khalifa, 2012. 6. Type definition. Variable declaration. Member access ... 7 struct CDAccountV1 ←Name of new "type". { double balance;. ← member name