Memory Management is the art of keeping track of memory hierarchy. Memory is divided into allocation units as small as a few words and as large as several thousand words. Memory Management with!itmaps is a simple way to keep track of memoory words in a 0xed amount of memory.
Memory Management is the art of keeping track of memory hierarchy. Memory is divided into allocation units as small as a few words and as large as several thousand words. Memory Management with!itmaps is a simple way to keep track of memoory words in a 0xed amount of memory.
Memory Management is the art of keeping track of memory hierarchy. Memory is divided into allocation units as small as a few words and as large as several thousand words. Memory Management with!itmaps is a simple way to keep track of memoory words in a 0xed amount of memory.
Computers have a few MB of very fast, expensive, volatile cache memory, a few GB of medium-speed, medium priced, volatile main memory, adn a few TB of slow, cheap, nonvolatile disk storage, not to mention removable storage, such as !"s and #$B"s Memory Manager %art of operating system that manages memory hierarchy Memory Abstraction &' No Memory Abstraction only run & process at a time it is possible to run multiple program by using swapping method 2. Memory Abstraction : Address Spaces 2.1. The Notion of Address Space (ddress $pace as a new abstraction for memory which creates a kind of abstract memory for program to live in' )t"s a set of addresses that a process can use to address memory' Base and *imit +egisters is a simple solution which uses a particularly simple version of dynamic relocation, which map each process"s address space onto a di,erent part of physical memory in a simple way' it is an easy way to give each process its own private adress space because it is generated automatically, but it is slow due to the need to perform addition which carry propagation time unless special addition circuits are used' 2.2 Swapping ( strategy consisting of bringing in each process in its entirety, running it for a while, then putting it back on the disk' $wapping creates multiple holes in memory, which can be combine into one by moving the process downward, this techni-ue is known as Memory Compaction' 2.3 Managing ree Memory 2.3.1 Memory Management with !itmaps .ith a bitmap, memory is divided into allocation units as small as a few words and as large as several /B' ( bitmap provides a simple way to keep track of memoory words in a 0xed amount of memory because the si1e of bitmap depends only on the si1e of memory and the si1e of the allocation unit' $earching a bitmap for a run of given length is a slow operation' 2.3.2 Memory Management with "in#ed "ists (nother way of keeping track of memory is to maintain a linked list of allocated and free memory segments, where a segment either contains a process or is an empty hole between two process' 3. $irt%a& Memory 3.1 'aging %ages is a virtul address soaces which is divided into 0xed-si1e units' .hile page frames is the corresponding units in the physical memory' 3.2 'aging Tab&es The purpose of paging tables is to map virtual pages onto page frames' 3.3 Speeding (p 'aging The simplest design is to have a single page table consisting of an array of fast hardware registers, with one entry for each virtual page, indexed by virtual page number' 2ven though it re-uires no memory references during mapping, it"s unbearably expensive if the page table is large and it also hurts performance' 3.) 'age Tab&es for "arge Memories 3.).1 M%&ti&e*e& 'age Tab&es Multilevel page table is a method to avoid keeping all the page tables in memory of all the time' 3.).2 +n*erted 'age Tab&es )n this table, there is one entry per page frame in real memory, rather than one entry per page of virtual address space' The entry keeps track of which process is located in the page frame' ). 'age ,ep&acements A&gorithm +emoves a page from memory to make room for the incoming page' ).1 The -ptima& 'age ,ep&acement A&gorithm *abel each page with the number of instructions that will be executed' +emove the highest labeled page' ).2 The Not ,ecent&y (sed 'age ,ep&acement A&gorithm ).3 The irst.+n/ irst.-%t 'age ,ep&acement A&gorithm ).) The Second Chance 'age ,ep&acement A&gorithm looks for an old page that has not been referenced in the most recent clock interval' )f all the pages have been referenced, second chance degenerates into pure 3)34' ).0 The C&oc# 'age ,ep&acement A&gorithm keep all the page frames on a circular list in the form of a clock' ).1 The "east ,ecent&y (sed 'age ,ep&acement A&gorithm ).2 Sim%&ating ",( in Software ).3 The 4or#ing Set 'age ,ep&acement A&gorithm ).5 The 4SC&oc# 'age ,ep&acement A&gorithm ).16 S%mmary of 'age ,ep&acement A&gorithm The two best algorithms are aging and .$Clock' They are based on *+# and the working set' Both give good paging performance and can be implemented e5ciently' 0. 7esign +ss%es for 'aging Systems 0.1 "oca& $S 8&oba& A&&ocation 'o&icies 0.2 "oad Contro& 0.3 'age Si9e 0.) Seperate +nstr%ction and 7ata Spaces 0.0 Shared 'ages 0.1 Shared "ibraries 0.2 Mapped i&es 0.3 C&eaning 'o&icy 0.5 $irt%a& Memory +nterface 1. +mp&ementation +ss%es 1.1 -perating System +n*o&*ement with 'aging 1.2 'age a%&t Hand&ing 1.3 +nstr%ction !ac#%p 1.) "oc#ing 'ages in Memory 1.0 !ac#ing Store 1.1 Separation of 'o&icy and Mechanism 2. Segmentation 2.1 +mp&ementation of '%re Segmentation 2.2 Segmentation with 'aging : M("T+CS 2.3 Segmentation with 'aging : The +nte& 'enti%m i&e Systems 3iles are managed by 4$' 1 i&es 1.1 i&e Naming 3ile 6ame 7 3ile 2xtension 1.2 i&e Str%ct%re 3iles can be structured in Byte se-uence, +ecord se-uence and Tree' 1.3 i&e Types +egular 0les are generally either ($C)) or binary 0les' 1.) i&e Access 1.0 i&e Attrib%tes other information of a 0le 8date and time the 0le was last modi0ed, 0le"s si1e9 1.1 i&e -perations Create, elete, 4pen, Close, +ead, .rite, (ppend, $eek, Get (ttributes, $et (ttributes, +ename 1.2 An :;amp&e 'rogram %sing i&e System Ca&&s 2. 7irectories 2.1 Sing&e.&e*e& 7irectory Systems one direcotry containing all the 0les, usually called the root directory 2.2 Hieararchica& 7irectory Systems Tree of directories 2.3 'ath Names path to specify a 0le name from a directory 2.) 7irectory -perations almost the ame as 3ile 4perations 3. i&e Systems +mp&ementation 3.1 i&e System "ayo%t a layout of a 0le systems which contains blocks and directories 3.2 +mp&ementing i&es /eeping track of which disk blocks go with which 0le 3.2.1 Contagio%s A&&ocation Track using : numbers ; the disk address of the 0rst block and the number of blocks in the 0le 3.2.2 "in#ed "ist A&&ocation keep each one as a linked list of disk blocks 3.2.3 "in#ed "ist A&&ocation (sing a Tab&e in Memory Take the pointer word from each disk block and putting it in a table in memory, 3(T 83ile (llocation Table9 3.2.) +.nodes lists the atributes and disk addresses of the 0le"s blocks 3.3 +mp&ementing 7irectories 3.) Shared i&es 3.0 "og.Str%ct%red i&e Systems 3.1 <o%rna&ing i&e Systems 3.2 $irt%a& i&e Systems ). i&e System Management and -ptimi9ation ).1 7is# Space Management ).1.1 !&oc# Si9e ).1.2 =eeping Trac# of ree !&oc#s ).1.3 7is# >%otas ).2 i&e System !ac#%ps Making backups from disaster or accidents ).3 i&e System Consistency ).) i&e System 'erformance ).).1 Caching Collection of blocks that logically belong on the disk but are being kept in memory for performance reasons' ).).2 !&oc# ,ead Ahead try to get blocks into the cache before they are needed to increase the hit rate 8looking into the future < 8o'49 9 ).).3 ,ed%cing 7is# Arm Motion %utting blocks that are likely to be accessed in se-uence close to each other, preferably in the same cylinder ).0 7efragmenting 7is#s $elect fragmented 0les near the start of the partition and copy all their blocks to the free space, which will free up a contageous block of space near the start of the partition into which the original or other 0les can be placed contiguously 0. :;amp&e i&e Systems 0.1 C7.,-M i&e Systems 0.2 The MS.7-S i&e Systems 0.3 The (N+? $2 i&e Systems +@- 7ead&oc# 1. ,eso%rces =ardware device or a piece of information 1.1 'reemptab&e and Non'reemptab&e ,eso%rces %reemptable is one that can be taken away from the process owning it with no ill e,ects, while nonpreemptable is the one that cannot be taken away 8e'g' ; Burning C9 1.2 ,eso%rce AcA%isition 2. +ntrod%ction to 7ead&oc#s eadlock is a set of processes when each of them in the set is waiting for an event that only another process in the set can cause 2.1 Conditions for ,eso%rce 7ead&oc#s 2.1.1 M%t%a& e;c&%sion condition 2ach resource is either currently assigned to exactly one process or is available 2.1.2 Ho&d and wait condition %rocesses currently holding resources that were granted earlier can re-uest new resources 2.1.3 No 'reemption Condition +esources previously granted cannot be forcibly taken away form a process 2.1.) Circ%&ar 4ait Condition There must be a circular chain of two or more processes, each of which is waiting for a resource held by the next member of the chain 2.2 7ead&oc# Mode&ing 3. The -strich A&gorithm $tick your head in the sand and pretend there is no problem at all' simply ignoring deadlock 8%ussy (lgorithm9 ). 7ead&oc# 7etection and ,eco*ery ).1 7ead&oc# 7etection with -ne ,eso%rce of :ach Type ).2 7ead&oc# 7etection with M%&tip&e ,eso%rces of :ach Type ).3 ,eco*ery form 7ead&oc# ).3.1 ,eco*ery thro%gh 'reemption temporarily take a resource away from its owner and give it to another process that need it ).3.2 ,eco*ery thro%gh ,o&&bac# Go back to checkpoint 8>ust like in game when game over9 ).3.3 ,eco*er thro%gh =i&&in 'rocesses ?ust as the name''' kill one process that cause the problem''' and also it must make the process work'' think before you kill''' 0. 7ead&oc# A*oidance 0.1 ,eso%ce TraBectories 0.2 Safe and (nsafe States safe, normal working process'' unsafe, have a chance to cause deadlock 0.3 The !an#erCs A&gorithm for a Sing&e ,eso%rce check if the re-uest leads to safe or unsafe state''' decline unsafe state 0.) The !an#erCs A&gorithm for M%&tip&e ,eso%rces 1. 7ead&oc# 're*ention 1.1 Attac#ing the M%t%a& :;c&%sion Condition 1.2 Attac#ing the Ho&d and 4ait Condition 1.3 Attac#ing the Nopreemption Condition 1.) Attac#ing the Circ%&ar 4ait Condition 2. -ther +ss%es 2.1 Two 'hase "oc#ing process tries to lock all the records it needs, one at a time' )f it succeeds, it perform updates and releasing the locks' .hat if it is already locked before the 0rst step< 2.2 Comm%nication 7ead&oc#s countered by Timeout 2.3 "i*e&oc# 2.) Star*ation re-uest for resources problems''' can be avoided by 0rst come 0rst serve rule