diff --git a/7. Memory Management.html b/7. Memory Management.html deleted file mode 100644 index 8609532..0000000 --- a/7. Memory Management.html +++ /dev/null @@ -1,1537 +0,0 @@ -7. Memory Management

Chapter 7: Memory Management

- -
// memory size 256K
-// initial memory allocation
-O/S Partition = 40K
-User Partition = 216K
-
-// memory requirements for jobs using a FCFS scheduling
-J1 = 60K , 10 time units (CPU burst time)
-J2 = 100K, 5 time units
-J3 = 30K, 20 time units
-J4 = 70K, 8 time units
-J5 = 50K, 15 time units
-J6 = 60K, 9 time units
-
-// Allocation happens the following way
-
-// J1 allocation
-2 Partition: 40K --> 100K
-Unallocated Partition : 156K
-
-// J2 Allocation
-Partition: 100K --> 200K
-Unallocated Partition: 56K
-
-// J3 Allocation
-Partition: 200K --> 230K
-Unallocated Partition: 26K
-
- - -
O/S Partition: 0 --> 40K
-
-// J1 allocation
-2 Partition: 40K --> 100K
-Unallocated partition: 100K --> 200K (after J2 released it)
-
-// J3 Allocation
-Partition: 200K --> 230K
-Unallocated Partition: 26K (230K - 256K)
-
-// J4 Allocation
-Partition: 100K --> 170K
-Unallocated Partition: 30K (170K - 200K) // this makes two unallocated partitions in memory
-
- - -
O/S Partition: 0 --> 40K
-
-Unallocated partition: 60K (40K - 100K) (after J1 released it)
-
-// J4 Allocation
-Partition: 100K --> 170K
-Unallocated Partition: 30K (170K - 200K) 
-
-// J3 Allocation
-Partition: 200K --> 230K
-Unallocated Partition: 26K (230K - 256K)
-
-// J5 Allocation
-Partition: 40K --> 90K
-Unallocated Partition: 10K (90K - 100K)
-
- - -
// logical address calculation
-p = L div P // integer division
-d = L mod P
-
-// physical address calculation
-Physical address = (f-1) * P + d
-
- - -

Segmented Memory Management (SMM)

- -
// functions of different size
-Main()
-Sqrt()
-Factorial()
-Billing()
-
- - -

Demand Paging (Virtual Memory Management) - Another memory management technique.

- -
Step 1: Start Processing an Instruction
-Step 2: CPU Generate Address
-Step 3: Page number is generated
-Step 4: Check PMT if Page available in Main Memory
-
-If page in MM:
-  Step 5: Fetch the data & compute the instruction
-  Step 6: CPU advances to the next instruction
-  Step 7: Process continues
-Else:
-  Step 5: Page fault interrupt is processed 
-
- - -
// Step 5:
-Step 1: 
-If there is no free block in MM:
-  Step 2: Select a page in MM for replacement
-  Step 3: Adjust PMT (change bit)
-  Step 4: Check if page was modified
-  If yes:
-    Step 5: Write back into Secondary Storage
-  Else:
-    Step 6: Free address for the new page
-Else:
-  Step 2: Get Disk Access of the new page from FMT (File Map Table)
-  Step 3: Read in Page
-  Step 4: Adjust PMT for new page
-  Step 5: Restart the interrupted instruction
-  Step 6: Continue processing instructions
-
- - -
// order of page numbers
-7, 0, 1 ,2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1 ,7, 0, 1, 
-
-// three memory frames are available 
-[ ]
-[ ]
-[ ]
-
- - -
// page 7 issues a page interrupt and then is loaded into MM
-// no page replacement in needed since there is free frame
-[7]
-[ ]
-[ ]
-
-// page 0 is referred, page interrupt, no page replacement
-[7]
-[0]
-[ ]
-
-// page 1 referred, page interrupt, no page replacement
-[7]
-[0]
-[1]
-
-// page 2 referred, page interrupt, yes page replacement using FIFO
-[2]
-[0]
-[1]
-
-// page 0 nothing happens
-
-// page 3 referred, page interrupt, yes page replacement
-[2]
-[3]
-[1]
-
-// page 0
-[2]
-[3]
-[0]
-
-// page 4
-[4]
-[3]
-[0]
-
-// page 2
-[4]
-[2]
-[0]
-
-// page 3
-[4]
-[2]
-[3]
-
-// page 0
-[0]
-[2]
-[3]
-
-// page 3, 2 - nothing happens
-
-// page 1
-[0]
-[1]
-[3]
-
-// page 2
-[0]
-[1]
-[2]
-
-// page 0, 1 
-
-// page 7
-[7]
-[1]
-[2]
-
-// page 0
-[7]
-[0]
-[2]
-
-// page 1
-[7]
-[0]
-[1]
-
- - -

// page 7 referred
-[7]
-[ ]
-[ ]
-
-// page 0
-[7]
-[0]
-[0]
-
-// page 1
-[7]
-[0]
-[1]
-
-// page 2 (replace with recently used page)
-[2]
-[0]
-[1]
-
-// page 0
-// page 3
-[2]
-[0]
-[3]
-
-// page 0
-// page 4
-[4]
-[0]
-[3]
-
-// page 2
-[4]
-[0]
-[2]
-
-// page 3
-[4]
-[3]
-[2]
-
-// page 0
-[0]
-[3]
-[2]
-
-// page 3
-// page 2
-// page 1
-[1]
-[3]
-[2]
-
-// page 2
-// page 0
-[1]
-[0]
-[2]
-
-// page 1
-// page 7
-[1]
-[0]
-[7]
-
-// page 1
-// page 7
-// page 0
-// page 1
-

-- miss ratio (12/20). hit ratio (8/20).

-
\ No newline at end of file diff --git a/8. Cache Memory.md b/8. Cache Memory.md index f219851..8a5f6f1 100644 --- a/8. Cache Memory.md +++ b/8. Cache Memory.md @@ -9,4 +9,4 @@ - A __tag address__ is compared with the physical address generated for a particular instruction. If there is a match, then that instruction exist in cache memory. If not, the go to main memory fetch the data/instruction and put it in cache memory and save the tag. This tag memory / table work similar to the segment/page map table. -- __Parallel search__ is used to search if the block number exists or has a tag address. +- __Parallel search__ is used to search if the block number exists or has a tag address. \ No newline at end of file diff --git a/README.md b/README.md index d4b3728..f96fcc9 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ A useful handbook for getting to know the basics on **Operating System Concepts* - Chapter 6 - [Deadlock - Part 2 (Algorithms)](https://github.com/omarsar/os/blob/master/6.%20Deadlock%20-%20Part%202%20(Algorithms).md) - Chapter 6 - [Deadlock - Part 3 (Distributed Environment)](https://github.com/omarsar/os/blob/master/6.%20Deadlock%20-%20Part%203%20(Distributed%20Environment).md) - Chapter 7 - [Memory Management](https://github.com/omarsar/os/blob/master/7.%20Memory%20Management.md) -- Chapter 8 - [Cache Memory]() +- Chapter 8 - [Cache Memory](https://github.com/omarsar/os/blob/master/8.%20Cache%20Memory.md) ### :point_right: TODO List - Add examples through images.