Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics...
Transcript of Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics...
![Page 1: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/1.jpg)
Operating Systems
Assignment 2
Daniel Gruss
November 25, 2020
![Page 2: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/2.jpg)
Topics
![Page 3: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/3.jpg)
Topics www.tugraz.at
Presented Today:
� Mandatory: Virtual Memory (Copy On Write, Swapping)
� Shared Memory
� Memory Mapped I/O
� Dynamic Memory in the userspace
Other Topics:
� You can do basically anything OS related
� Just ask your Tutor how many points it brings
1
![Page 4: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/4.jpg)
Topics www.tugraz.at
Presented Today:
� Mandatory: Virtual Memory (Copy On Write, Swapping)
� Shared Memory
� Memory Mapped I/O
� Dynamic Memory in the userspace
Other Topics:
� You can do basically anything OS related
� Just ask your Tutor how many points it brings
1
![Page 5: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/5.jpg)
Topics www.tugraz.at
Presented Today:
� Mandatory: Virtual Memory (Copy On Write, Swapping)
� Shared Memory
� Memory Mapped I/O
� Dynamic Memory in the userspace
Other Topics:
� You can do basically anything OS related
� Just ask your Tutor how many points it brings
1
![Page 6: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/6.jpg)
Topics www.tugraz.at
Presented Today:
� Mandatory: Virtual Memory (Copy On Write, Swapping)
� Shared Memory
� Memory Mapped I/O
� Dynamic Memory in the userspace
Other Topics:
� You can do basically anything OS related
� Just ask your Tutor how many points it brings
1
![Page 7: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/7.jpg)
Topics www.tugraz.at
Presented Today:
� Mandatory: Virtual Memory (Copy On Write, Swapping)
� Shared Memory
� Memory Mapped I/O
� Dynamic Memory in the userspace
Other Topics:
� You can do basically anything OS related
� Just ask your Tutor how many points it brings
1
![Page 8: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/8.jpg)
Topics www.tugraz.at
Presented Today:
� Mandatory: Virtual Memory (Copy On Write, Swapping)
� Shared Memory
� Memory Mapped I/O
� Dynamic Memory in the userspace
Other Topics:
� You can do basically anything OS related
� Just ask your Tutor how many points it brings
1
![Page 9: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/9.jpg)
Virtual Memory
![Page 10: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/10.jpg)
Virtual Memory www.tugraz.at
� Swap pages to the swap device (from RAM to HDD)
� Don’t forget to lock shared resources!
What does the operating system need to know?
� Where is the swap device located?
� Where to find free space within the swap device?
� Has a page been swapped out, or is it within RAM?
� Where has a page been swapped to (target address)?
2
![Page 11: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/11.jpg)
Virtual Memory www.tugraz.at
� Swap pages to the swap device (from RAM to HDD)
� Don’t forget to lock shared resources!
What does the operating system need to know?
� Where is the swap device located?
� Where to find free space within the swap device?
� Has a page been swapped out, or is it within RAM?
� Where has a page been swapped to (target address)?
2
![Page 12: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/12.jpg)
Virtual Memory www.tugraz.at
� Swap pages to the swap device (from RAM to HDD)
� Don’t forget to lock shared resources!
What does the operating system need to know?
� Where is the swap device located?
� Where to find free space within the swap device?
� Has a page been swapped out, or is it within RAM?
� Where has a page been swapped to (target address)?
2
![Page 13: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/13.jpg)
Virtual Memory www.tugraz.at
� Swap pages to the swap device (from RAM to HDD)
� Don’t forget to lock shared resources!
What does the operating system need to know?
� Where is the swap device located?
� Where to find free space within the swap device?
� Has a page been swapped out, or is it within RAM?
� Where has a page been swapped to (target address)?
2
![Page 14: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/14.jpg)
Virtual Memory www.tugraz.at
� Swap pages to the swap device (from RAM to HDD)
� Don’t forget to lock shared resources!
What does the operating system need to know?
� Where is the swap device located?
� Where to find free space within the swap device?
� Has a page been swapped out, or is it within RAM?
� Where has a page been swapped to (target address)?
2
![Page 15: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/15.jpg)
Virtual Memory www.tugraz.at
� Swap pages to the swap device (from RAM to HDD)
� Don’t forget to lock shared resources!
What does the operating system need to know?
� Where is the swap device located?
� Where to find free space within the swap device?
� Has a page been swapped out, or is it within RAM?
� Where has a page been swapped to (target address)?
2
![Page 16: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/16.jpg)
3
![Page 17: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/17.jpg)
4
![Page 18: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/18.jpg)
Access the HDD in SWEB www.tugraz.at
� Virtual Memory is located at the third partition of the first HDD
� (BD device number 3)
� Responsible Code: arch_bd_*
5
![Page 19: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/19.jpg)
Example (Write to BD (Pseudocode))size_t block = target block number ;
pointer page_data = pointer to source data ;
BDVirtualDevice* bd_device = BDManager : : getInstance ( )=>getDeviceByNumber (3 ) ;bd_device=>writeData (block*bd_device=>getBlockSize ( ) , PAGE_SIZE , page_data ) ;
Do not use BDRequest directly unless you asked a Tutor!
Using BDRequest directly is unsafe!
6
![Page 20: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/20.jpg)
Which pages are swappable? www.tugraz.at
� User space pages (where does it make sense?)
� Mark PTs/PDs/PDPTs as non-present and swapped out
� Kernel pages (has not been done before)
7
![Page 21: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/21.jpg)
Which pages are swappable? www.tugraz.at
� User space pages (where does it make sense?)
� Mark PTs/PDs/PDPTs as non-present and swapped out
� Kernel pages (has not been done before)
7
![Page 22: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/22.jpg)
Which pages are swappable? www.tugraz.at
� User space pages (where does it make sense?)
� Mark PTs/PDs/PDPTs as non-present and swapped out
� Kernel pages (has not been done before)
7
![Page 23: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/23.jpg)
Page Table Usage (x86 64) www.tugraz.at
present == 0: entry invalid, all bits ignored
by MMU
→ pagefault on access
writeable == 0: write protected
accessed, dirty == 1: has been
accessed/modified
ignored x : unused bits
page ppn : physical page number
typedef struct
{uint64 present : 1 ;
uint64 writeable : 1 ;
uint64 user_access : 1 ;
uint64 write_through : 1 ;
uint64 cache_disabled : 1 ;
uint64 accessed : 1 ;
uint64 dirty : 1 ;
uint64 size : 1 ;
uint64 global : 1 ;
uint64 ignored_2 : 3 ;
uint64 page_ppn : 2 8 ;
uint64 reserved_1 : 1 2 ;
uint64 ignored_1 : 1 1 ;
uint64 execution_disabled : 1 ;
} PageTableEntry ;
8
![Page 24: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/24.jpg)
Write Tests www.tugraz.at
� Use tests which use big arrays
(e.g. size t array[BIG NUMBER];)
� Test all swapping-situations
� ..., without running into the limits of the kernel heap.
� Free memory can exhaust soon (even with a good PRA)!
9
![Page 25: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/25.jpg)
Write Tests www.tugraz.at
� Use tests which use big arrays
(e.g. size t array[BIG NUMBER];)
� Test all swapping-situations
� ..., without running into the limits of the kernel heap.
� Free memory can exhaust soon (even with a good PRA)!
9
![Page 26: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/26.jpg)
Write Tests www.tugraz.at
� Use tests which use big arrays
(e.g. size t array[BIG NUMBER];)
� Test all swapping-situations
� ..., without running into the limits of the kernel heap.
� Free memory can exhaust soon (even with a good PRA)!
9
![Page 27: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/27.jpg)
Write Tests www.tugraz.at
� Use tests which use big arrays
(e.g. size t array[BIG NUMBER];)
� Test all swapping-situations
� ..., without running into the limits of the kernel heap.
� Free memory can exhaust soon (even with a good PRA)!
9
![Page 28: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/28.jpg)
Page Replacement Algorithms www.tugraz.at
What does a PRA do?
� Searches for pages that have not been used for a while
� Runs if memory is needed or there is nothing to be done
� But not every time...
Where to find PRA documentations?
� Books / VO slides / Internet
� Create your own PRA (why is it better than other PRAs?)
� A simple FiFo is not enough!
� Recommended: Aging/WSClock
10
![Page 29: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/29.jpg)
Page Replacement Algorithms www.tugraz.at
What does a PRA do?
� Searches for pages that have not been used for a while
� Runs if memory is needed or there is nothing to be done
� But not every time...
Where to find PRA documentations?
� Books / VO slides / Internet
� Create your own PRA (why is it better than other PRAs?)
� A simple FiFo is not enough!
� Recommended: Aging/WSClock
10
![Page 30: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/30.jpg)
Page Replacement Algorithms www.tugraz.at
What does a PRA do?
� Searches for pages that have not been used for a while
� Runs if memory is needed or there is nothing to be done
� But not every time...
Where to find PRA documentations?
� Books / VO slides / Internet
� Create your own PRA (why is it better than other PRAs?)
� A simple FiFo is not enough!
� Recommended: Aging/WSClock
10
![Page 31: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/31.jpg)
Page Replacement Algorithms www.tugraz.at
What does a PRA do?
� Searches for pages that have not been used for a while
� Runs if memory is needed or there is nothing to be done
� But not every time...
Where to find PRA documentations?
� Books / VO slides / Internet
� Create your own PRA (why is it better than other PRAs?)
� A simple FiFo is not enough!
� Recommended: Aging/WSClock
10
![Page 32: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/32.jpg)
Page Replacement Algorithms www.tugraz.at
What does a PRA do?
� Searches for pages that have not been used for a while
� Runs if memory is needed or there is nothing to be done
� But not every time...
Where to find PRA documentations?
� Books / VO slides / Internet
� Create your own PRA (why is it better than other PRAs?)
� A simple FiFo is not enough!
� Recommended: Aging/WSClock
10
![Page 33: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/33.jpg)
Page Replacement Algorithms www.tugraz.at
What does a PRA do?
� Searches for pages that have not been used for a while
� Runs if memory is needed or there is nothing to be done
� But not every time...
Where to find PRA documentations?
� Books / VO slides / Internet
� Create your own PRA (why is it better than other PRAs?)
� A simple FiFo is not enough!
� Recommended: Aging/WSClock
10
![Page 34: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/34.jpg)
Page Replacement Algorithms www.tugraz.at
What does a PRA do?
� Searches for pages that have not been used for a while
� Runs if memory is needed or there is nothing to be done
� But not every time...
Where to find PRA documentations?
� Books / VO slides / Internet
� Create your own PRA (why is it better than other PRAs?)
� A simple FiFo is not enough!
� Recommended: Aging/WSClock
10
![Page 35: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/35.jpg)
Sytem Time www.tugraz.at
Some PRAs need time informations
Where to get them from?
� Ticks, TSC, RTC
� Recycle parts of the sleep- or clock-implementation
� Derive the time from the tick sources
� Hint: InterruptUtils.cpp
11
![Page 36: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/36.jpg)
Sytem Time www.tugraz.at
Some PRAs need time informations
Where to get them from?
� Ticks, TSC, RTC
� Recycle parts of the sleep- or clock-implementation
� Derive the time from the tick sources
� Hint: InterruptUtils.cpp
11
![Page 37: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/37.jpg)
Sytem Time www.tugraz.at
Some PRAs need time informations
Where to get them from?
� Ticks, TSC, RTC
� Recycle parts of the sleep- or clock-implementation
� Derive the time from the tick sources
� Hint: InterruptUtils.cpp
11
![Page 38: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/38.jpg)
Sytem Time www.tugraz.at
Some PRAs need time informations
Where to get them from?
� Ticks, TSC, RTC
� Recycle parts of the sleep- or clock-implementation
� Derive the time from the tick sources
� Hint: InterruptUtils.cpp
11
![Page 39: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/39.jpg)
Inverted Page Table
![Page 40: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/40.jpg)
Shared Pages www.tugraz.at
� Pages may be used by several processes
� Aka: Page table entries of different user spaces point to the same physical page
� Where can shared pages be located at?
� RAM
� Swap
� Binary
� Copy-on-Write (coming soon)
12
![Page 41: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/41.jpg)
Shared Pages www.tugraz.at
� Pages may be used by several processes
� Aka: Page table entries of different user spaces point to the same physical page
� Where can shared pages be located at?
� RAM
� Swap
� Binary
� Copy-on-Write (coming soon)
12
![Page 42: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/42.jpg)
Shared Pages www.tugraz.at
� Pages may be used by several processes
� Aka: Page table entries of different user spaces point to the same physical page
� Where can shared pages be located at?
� RAM
� Swap
� Binary
� Copy-on-Write (coming soon)
12
![Page 43: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/43.jpg)
Shared Pages www.tugraz.at
� Pages may be used by several processes
� Aka: Page table entries of different user spaces point to the same physical page
� Where can shared pages be located at?
� RAM
� Swap
� Binary
� Copy-on-Write (coming soon)
12
![Page 44: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/44.jpg)
Shared Pages www.tugraz.at
� Pages may be used by several processes
� Aka: Page table entries of different user spaces point to the same physical page
� Where can shared pages be located at?
� RAM
� Swap
� Binary
� Copy-on-Write (coming soon)
12
![Page 45: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/45.jpg)
Shared Pages www.tugraz.at
� Pages may be used by several processes
� Aka: Page table entries of different user spaces point to the same physical page
� Where can shared pages be located at?
� RAM
� Swap
� Binary
� Copy-on-Write (coming soon)
12
![Page 46: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/46.jpg)
Shared Pages www.tugraz.at
� Pages may be used by several processes
� Aka: Page table entries of different user spaces point to the same physical page
� Where can shared pages be located at?
� RAM
� Swap
� Binary
� Copy-on-Write (coming soon)
12
![Page 47: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/47.jpg)
13
![Page 48: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/48.jpg)
Virtual Memory and Shared Pages www.tugraz.at
Inverted Page Table connects a physical page/swapped page to all virtual page usages
Only one process uses the page:
� Page is swapped out → process has to be informed
� So we have to know which process owns the page
Shared Pages (Several processes use the same page):
� All processes have to be informed when a page is swapped out
� So we have to know which processes own the page
� The process terminates → reference has to be removed
14
![Page 49: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/49.jpg)
Virtual Memory and Shared Pages www.tugraz.at
Inverted Page Table connects a physical page/swapped page to all virtual page usages
Only one process uses the page:
� Page is swapped out → process has to be informed
� So we have to know which process owns the page
Shared Pages (Several processes use the same page):
� All processes have to be informed when a page is swapped out
� So we have to know which processes own the page
� The process terminates → reference has to be removed
14
![Page 50: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/50.jpg)
Virtual Memory and Shared Pages www.tugraz.at
Inverted Page Table connects a physical page/swapped page to all virtual page usages
Only one process uses the page:
� Page is swapped out → process has to be informed
� So we have to know which process owns the page
Shared Pages (Several processes use the same page):
� All processes have to be informed when a page is swapped out
� So we have to know which processes own the page
� The process terminates → reference has to be removed
14
![Page 51: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/51.jpg)
Virtual Memory and Shared Pages www.tugraz.at
Inverted Page Table connects a physical page/swapped page to all virtual page usages
Only one process uses the page:
� Page is swapped out → process has to be informed
� So we have to know which process owns the page
Shared Pages (Several processes use the same page):
� All processes have to be informed when a page is swapped out
� So we have to know which processes own the page
� The process terminates → reference has to be removed
14
![Page 52: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/52.jpg)
Virtual Memory and Shared Pages www.tugraz.at
Inverted Page Table connects a physical page/swapped page to all virtual page usages
Only one process uses the page:
� Page is swapped out → process has to be informed
� So we have to know which process owns the page
Shared Pages (Several processes use the same page):
� All processes have to be informed when a page is swapped out
� So we have to know which processes own the page
� The process terminates → reference has to be removed
14
![Page 53: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/53.jpg)
Virtual Memory and Shared Pages www.tugraz.at
Inverted Page Table connects a physical page/swapped page to all virtual page usages
Only one process uses the page:
� Page is swapped out → process has to be informed
� So we have to know which process owns the page
Shared Pages (Several processes use the same page):
� All processes have to be informed when a page is swapped out
� So we have to know which processes own the page
� The process terminates → reference has to be removed
14
![Page 54: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/54.jpg)
Copy On Write
![Page 55: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/55.jpg)
Copy On Write www.tugraz.at
� Usage of fork():
1. fork() clones a process (copy, copy, copy...)
2. The child process often uses exec(...) after fork()
3. There has been much useless deep copying and deleting
� Do we really have to copy all the stuff?
� Both processes use the same physical and swapped pages
� Two (or more) processes have the same pages in RAM/Swap Device
� Works as long as no one is writing onto them
15
![Page 56: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/56.jpg)
Copy On Write www.tugraz.at
� Usage of fork():
1. fork() clones a process (copy, copy, copy...)
2. The child process often uses exec(...) after fork()
3. There has been much useless deep copying and deleting
� Do we really have to copy all the stuff?
� Both processes use the same physical and swapped pages
� Two (or more) processes have the same pages in RAM/Swap Device
� Works as long as no one is writing onto them
15
![Page 57: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/57.jpg)
Copy On Write www.tugraz.at
� Usage of fork():
1. fork() clones a process (copy, copy, copy...)
2. The child process often uses exec(...) after fork()
3. There has been much useless deep copying and deleting
� Do we really have to copy all the stuff?
� Both processes use the same physical and swapped pages
� Two (or more) processes have the same pages in RAM/Swap Device
� Works as long as no one is writing onto them
15
![Page 58: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/58.jpg)
Copy On Write www.tugraz.at
� Usage of fork():
1. fork() clones a process (copy, copy, copy...)
2. The child process often uses exec(...) after fork()
3. There has been much useless deep copying and deleting
� Do we really have to copy all the stuff?
� Both processes use the same physical and swapped pages
� Two (or more) processes have the same pages in RAM/Swap Device
� Works as long as no one is writing onto them
15
![Page 59: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/59.jpg)
Copy On Write www.tugraz.at
� Usage of fork():
1. fork() clones a process (copy, copy, copy...)
2. The child process often uses exec(...) after fork()
3. There has been much useless deep copying and deleting
� Do we really have to copy all the stuff?
� Both processes use the same physical and swapped pages
� Two (or more) processes have the same pages in RAM/Swap Device
� Works as long as no one is writing onto them
15
![Page 60: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/60.jpg)
Copy On Write www.tugraz.at
� Usage of fork():
1. fork() clones a process (copy, copy, copy...)
2. The child process often uses exec(...) after fork()
3. There has been much useless deep copying and deleting
� Do we really have to copy all the stuff?
� Both processes use the same physical and swapped pages
� Two (or more) processes have the same pages in RAM/Swap Device
� Works as long as no one is writing onto them
15
![Page 61: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/61.jpg)
Copy On Write www.tugraz.at
� Usage of fork():
1. fork() clones a process (copy, copy, copy...)
2. The child process often uses exec(...) after fork()
3. There has been much useless deep copying and deleting
� Do we really have to copy all the stuff?
� Both processes use the same physical and swapped pages
� Two (or more) processes have the same pages in RAM/Swap Device
� Works as long as no one is writing onto them
15
![Page 62: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/62.jpg)
Copy On Write www.tugraz.at
� Usage of fork():
1. fork() clones a process (copy, copy, copy...)
2. The child process often uses exec(...) after fork()
3. There has been much useless deep copying and deleting
� Do we really have to copy all the stuff?
� Both processes use the same physical and swapped pages
� Two (or more) processes have the same pages in RAM/Swap Device
� Works as long as no one is writing onto them
15
![Page 63: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/63.jpg)
Read-Only Pages and Pagefaults www.tugraz.at
� How do we realize that someone wants to write onto a page
� Usually we can’t
� The writeable-flag has to be zero
� Process tries to write onto a write-protected page
→ PageFault
� What shall we do now?
� → Is it a shared page?
� → Copy page and link to the new one
� → If only one process is left → no shared pages!
16
![Page 64: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/64.jpg)
Read-Only Pages and Pagefaults www.tugraz.at
� How do we realize that someone wants to write onto a page
� Usually we can’t
� The writeable-flag has to be zero
� Process tries to write onto a write-protected page
→ PageFault
� What shall we do now?
� → Is it a shared page?
� → Copy page and link to the new one
� → If only one process is left → no shared pages!
16
![Page 65: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/65.jpg)
Read-Only Pages and Pagefaults www.tugraz.at
� How do we realize that someone wants to write onto a page
� Usually we can’t
� The writeable-flag has to be zero
� Process tries to write onto a write-protected page
→ PageFault
� What shall we do now?
� → Is it a shared page?
� → Copy page and link to the new one
� → If only one process is left → no shared pages!
16
![Page 66: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/66.jpg)
Read-Only Pages and Pagefaults www.tugraz.at
� How do we realize that someone wants to write onto a page
� Usually we can’t
� The writeable-flag has to be zero
� Process tries to write onto a write-protected page
→ PageFault
� What shall we do now?
� → Is it a shared page?
� → Copy page and link to the new one
� → If only one process is left → no shared pages!
16
![Page 67: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/67.jpg)
Read-Only Pages and Pagefaults www.tugraz.at
� How do we realize that someone wants to write onto a page
� Usually we can’t
� The writeable-flag has to be zero
� Process tries to write onto a write-protected page
→ PageFault
� What shall we do now?
� → Is it a shared page?
� → Copy page and link to the new one
� → If only one process is left → no shared pages!
16
![Page 68: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/68.jpg)
Read-Only Pages and Pagefaults www.tugraz.at
� How do we realize that someone wants to write onto a page
� Usually we can’t
� The writeable-flag has to be zero
� Process tries to write onto a write-protected page
→ PageFault
� What shall we do now?
� → Is it a shared page?
� → Copy page and link to the new one
� → If only one process is left → no shared pages!
16
![Page 69: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/69.jpg)
Read-Only Pages and Pagefaults www.tugraz.at
� How do we realize that someone wants to write onto a page
� Usually we can’t
� The writeable-flag has to be zero
� Process tries to write onto a write-protected page
→ PageFault
� What shall we do now?
� → Is it a shared page?
� → Copy page and link to the new one
� → If only one process is left → no shared pages!
16
![Page 70: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/70.jpg)
Read-Only Pages and Pagefaults www.tugraz.at
� How do we realize that someone wants to write onto a page
� Usually we can’t
� The writeable-flag has to be zero
� Process tries to write onto a write-protected page
→ PageFault
� What shall we do now?
� → Is it a shared page?
� → Copy page and link to the new one
� → If only one process is left → no shared pages!
16
![Page 71: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/71.jpg)
17
![Page 72: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/72.jpg)
18
![Page 73: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/73.jpg)
What about the global flag? www.tugraz.at
� Don’t use it!
� “global” means “keep over next context switch”
� This is not what you want
� Will cause almost untraceable bugs!
� Use and rename an unused bit as “shared” flag instead
19
![Page 74: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/74.jpg)
What about the global flag? www.tugraz.at
� Don’t use it!
� “global” means “keep over next context switch”
� This is not what you want
� Will cause almost untraceable bugs!
� Use and rename an unused bit as “shared” flag instead
19
![Page 75: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/75.jpg)
What about the global flag? www.tugraz.at
� Don’t use it!
� “global” means “keep over next context switch”
� This is not what you want
� Will cause almost untraceable bugs!
� Use and rename an unused bit as “shared” flag instead
19
![Page 76: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/76.jpg)
What about the global flag? www.tugraz.at
� Don’t use it!
� “global” means “keep over next context switch”
� This is not what you want
� Will cause almost untraceable bugs!
� Use and rename an unused bit as “shared” flag instead
19
![Page 77: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/77.jpg)
What about the global flag? www.tugraz.at
� Don’t use it!
� “global” means “keep over next context switch”
� This is not what you want
� Will cause almost untraceable bugs!
� Use and rename an unused bit as “shared” flag instead
19
![Page 78: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/78.jpg)
Copy-on-Write www.tugraz.at
Virtual Address Space
Physical Address Space
20
![Page 79: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/79.jpg)
Copy-on-Write www.tugraz.at
Virtual Address Space
Physical Address Space
20
![Page 80: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/80.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
20
![Page 81: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/81.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
20
![Page 82: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/82.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
20
![Page 83: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/83.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
20
![Page 84: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/84.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
fork
Process B
20
![Page 85: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/85.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
20
![Page 86: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/86.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
20
![Page 87: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/87.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
20
![Page 88: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/88.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
20
![Page 89: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/89.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Process B tries to write
20
![Page 90: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/90.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Process B tries to write
copy
20
![Page 91: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/91.jpg)
Copy-on-Write www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
write
20
![Page 92: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/92.jpg)
Copy On Write Without Fork www.tugraz.at
� Starting /usr/shell.sweb twice, without fork
� Loading the same image in different programs
� Generating the same data in different progams
� → Page Deduplication
21
![Page 93: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/93.jpg)
Copy On Write Without Fork www.tugraz.at
� Starting /usr/shell.sweb twice, without fork
� Loading the same image in different programs
� Generating the same data in different progams
� → Page Deduplication
21
![Page 94: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/94.jpg)
Copy On Write Without Fork www.tugraz.at
� Starting /usr/shell.sweb twice, without fork
� Loading the same image in different programs
� Generating the same data in different progams
� → Page Deduplication
21
![Page 95: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/95.jpg)
Copy On Write Without Fork www.tugraz.at
� Starting /usr/shell.sweb twice, without fork
� Loading the same image in different programs
� Generating the same data in different progams
� → Page Deduplication
21
![Page 96: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/96.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
22
![Page 97: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/97.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Processes startedindependently
Process B
22
![Page 98: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/98.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
22
![Page 99: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/99.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
22
![Page 100: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/100.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
22
![Page 101: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/101.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
22
![Page 102: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/102.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
22
![Page 103: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/103.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
22
![Page 104: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/104.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
22
![Page 105: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/105.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
6=
22
![Page 106: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/106.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
6=
22
![Page 107: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/107.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
6=
22
![Page 108: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/108.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
6=
22
![Page 109: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/109.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
=
22
![Page 110: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/110.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
=
22
![Page 111: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/111.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
=
22
![Page 112: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/112.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
Done!
22
![Page 113: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/113.jpg)
Page Deduplication www.tugraz.at
Virtual Address SpaceProcess A
Physical Address Space
Process B
Deduplication Thread
22
![Page 114: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/114.jpg)
Additional Tasks
![Page 115: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/115.jpg)
Shared Memory www.tugraz.at
1. Process A wants to share 3 pages with process B
2. Process A syscall: get 3 pages of shared memory ID 4
3. Kernel: maps 3 virtual pages (10-12) of A to physical pages 464, 9078, and 123
4. Process B syscall: get 3 pages of shared memory ID 4
5. Kernel: maps 3 virtual pages (22-24) of A to physical pages 464, 9078, and 123
6. → A and B now share 3 pages
23
![Page 116: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/116.jpg)
Shared Memory www.tugraz.at
1. Process A wants to share 3 pages with process B
2. Process A syscall: get 3 pages of shared memory ID 4
3. Kernel: maps 3 virtual pages (10-12) of A to physical pages 464, 9078, and 123
4. Process B syscall: get 3 pages of shared memory ID 4
5. Kernel: maps 3 virtual pages (22-24) of A to physical pages 464, 9078, and 123
6. → A and B now share 3 pages
23
![Page 117: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/117.jpg)
Shared Memory www.tugraz.at
1. Process A wants to share 3 pages with process B
2. Process A syscall: get 3 pages of shared memory ID 4
3. Kernel: maps 3 virtual pages (10-12) of A to physical pages 464, 9078, and 123
4. Process B syscall: get 3 pages of shared memory ID 4
5. Kernel: maps 3 virtual pages (22-24) of A to physical pages 464, 9078, and 123
6. → A and B now share 3 pages
23
![Page 118: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/118.jpg)
Shared Memory www.tugraz.at
1. Process A wants to share 3 pages with process B
2. Process A syscall: get 3 pages of shared memory ID 4
3. Kernel: maps 3 virtual pages (10-12) of A to physical pages 464, 9078, and 123
4. Process B syscall: get 3 pages of shared memory ID 4
5. Kernel: maps 3 virtual pages (22-24) of A to physical pages 464, 9078, and 123
6. → A and B now share 3 pages
23
![Page 119: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/119.jpg)
Shared Memory www.tugraz.at
1. Process A wants to share 3 pages with process B
2. Process A syscall: get 3 pages of shared memory ID 4
3. Kernel: maps 3 virtual pages (10-12) of A to physical pages 464, 9078, and 123
4. Process B syscall: get 3 pages of shared memory ID 4
5. Kernel: maps 3 virtual pages (22-24) of A to physical pages 464, 9078, and 123
6. → A and B now share 3 pages
23
![Page 120: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/120.jpg)
Shared Memory www.tugraz.at
1. Process A wants to share 3 pages with process B
2. Process A syscall: get 3 pages of shared memory ID 4
3. Kernel: maps 3 virtual pages (10-12) of A to physical pages 464, 9078, and 123
4. Process B syscall: get 3 pages of shared memory ID 4
5. Kernel: maps 3 virtual pages (22-24) of A to physical pages 464, 9078, and 123
6. → A and B now share 3 pages
23
![Page 121: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/121.jpg)
Shared Memory: How To Implement www.tugraz.at
� Syscalls:
int shm_open(const char *name, int oflag, mode_t mode);
int shm_unlink(const char *name);
void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
int munmap(void *addr, size_t len);
� Manages IDs (pseudo file-descriptor) and users of the shared regions
� munmap and shm_unlink when the process ends or manually
� No reference to the shared memory object → destroy it
24
![Page 122: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/122.jpg)
Shared Memory: How To Implement www.tugraz.at
� Syscalls:
int shm_open(const char *name, int oflag, mode_t mode);
int shm_unlink(const char *name);
void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
int munmap(void *addr, size_t len);
� Manages IDs (pseudo file-descriptor) and users of the shared regions
� munmap and shm_unlink when the process ends or manually
� No reference to the shared memory object → destroy it
24
![Page 123: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/123.jpg)
Shared Memory: How To Implement www.tugraz.at
� Syscalls:
int shm_open(const char *name, int oflag, mode_t mode);
int shm_unlink(const char *name);
void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
int munmap(void *addr, size_t len);
� Manages IDs (pseudo file-descriptor) and users of the shared regions
� munmap and shm_unlink when the process ends or manually
� No reference to the shared memory object → destroy it
24
![Page 124: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/124.jpg)
Shared Memory: How To Implement www.tugraz.at
� Syscalls:
int shm_open(const char *name, int oflag, mode_t mode);
int shm_unlink(const char *name);
void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
int munmap(void *addr, size_t len);
� Manages IDs (pseudo file-descriptor) and users of the shared regions
� munmap and shm_unlink when the process ends or manually
� No reference to the shared memory object → destroy it
24
![Page 125: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/125.jpg)
Memory Mapped File I/O www.tugraz.at
� Files are not accessed by using (open/creat/close/read/write) any longer, they are
directy mapped into the address space
� Parts of the mapped file are copied into RAM on demand!
� They are written back when being unmapped (if they have been modified)
� Depends on the flags set when being mapped
� If several processes have the same file mapped → Shared Memory
25
![Page 126: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/126.jpg)
Memory Mapped File I/O www.tugraz.at
� Files are not accessed by using (open/creat/close/read/write) any longer, they are
directy mapped into the address space
� Parts of the mapped file are copied into RAM on demand!
� They are written back when being unmapped (if they have been modified)
� Depends on the flags set when being mapped
� If several processes have the same file mapped → Shared Memory
25
![Page 127: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/127.jpg)
Memory Mapped File I/O www.tugraz.at
� Files are not accessed by using (open/creat/close/read/write) any longer, they are
directy mapped into the address space
� Parts of the mapped file are copied into RAM on demand!
� They are written back when being unmapped (if they have been modified)
� Depends on the flags set when being mapped
� If several processes have the same file mapped → Shared Memory
25
![Page 128: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/128.jpg)
Memory Mapped File I/O www.tugraz.at
� Files are not accessed by using (open/creat/close/read/write) any longer, they are
directy mapped into the address space
� Parts of the mapped file are copied into RAM on demand!
� They are written back when being unmapped (if they have been modified)
� Depends on the flags set when being mapped
� If several processes have the same file mapped → Shared Memory
25
![Page 129: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/129.jpg)
Memory Mapped File I/O www.tugraz.at
� Files are not accessed by using (open/creat/close/read/write) any longer, they are
directy mapped into the address space
� Parts of the mapped file are copied into RAM on demand!
� They are written back when being unmapped (if they have been modified)
� Depends on the flags set when being mapped
� If several processes have the same file mapped → Shared Memory
25
![Page 130: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/130.jpg)
mmap / munmap www.tugraz.at
� void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
� int munmap(void *addr, size_t len);
fildes � shm open or open
� Which processes opened the same file?
len � Only multiples of PAGE_SIZE
� File size usually not PAGE_SIZE-aligned
26
![Page 131: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/131.jpg)
mmap / munmap www.tugraz.at
� void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
� int munmap(void *addr, size_t len);
protection : Access rights for the mapped areas
� PROT READ: How to prevent write accesses?
� PROT WRITE: flags relevant!
26
![Page 132: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/132.jpg)
mmap / munmap www.tugraz.at
� void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
� int munmap(void *addr, size_t len);
flags :
� MAP PRIVATE:
� Copy-on-write
� No write-back
� MAP SHARED:
� Write-back to file on munmap
� Changes visible to other processes immediately!
26
![Page 133: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/133.jpg)
mmap / munmap www.tugraz.at
� void *mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off);
� int munmap(void *addr, size_t len);
... easy to combine with shared memory syscalls
26
![Page 134: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/134.jpg)
Userspace Dynamic Memory www.tugraz.at
� Memory allocation at runtime
� Implement malloc/free
Address space of a process:
27
![Page 135: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/135.jpg)
Userspace Dynamic Memory www.tugraz.at
� Memory allocation at runtime
� Implement malloc/free
Address space of a process:
27
![Page 136: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/136.jpg)
How to use brk/sbrk www.tugraz.at
� int brk(void *end_data_segment);
� void *sbrk(int increment);
� Linker symbol _end
Example (sbrk/break in userspace)extern _end ;
// . . .
size_t heap_start = &_end ;
size_t heap_end = heap_start + 4096 ;
if ( brk (heap_end ) == 0)
{//do s t u f f i n dynamic memory
}
28
![Page 137: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/137.jpg)
How to use brk/sbrk www.tugraz.at
� int brk(void *end_data_segment);
� void *sbrk(int increment);
� Linker symbol _end
Example (sbrk/break in userspace)extern _end ;
// . . .
size_t heap_start = &_end ;
size_t heap_end = heap_start + 4096 ;
if ( brk (heap_end ) == 0)
{//do s t u f f i n dynamic memory
}
28
![Page 138: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/138.jpg)
Userspace Memory Management www.tugraz.at
brk and sbrk are complicated to use - let’s implement:
� malloc(size_t size)/free(void *p) in libc
� Manages the allocated memory regions
� Requests pages from the kernel
� Frees unused pages again
� therefore uses brk()/sbrk()
29
![Page 139: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/139.jpg)
Userspace Memory Management www.tugraz.at
brk and sbrk are complicated to use - let’s implement:
� malloc(size_t size)/free(void *p) in libc
� Manages the allocated memory regions
� Requests pages from the kernel
� Frees unused pages again
� therefore uses brk()/sbrk()
29
![Page 140: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/140.jpg)
Userspace Memory Management www.tugraz.at
brk and sbrk are complicated to use - let’s implement:
� malloc(size_t size)/free(void *p) in libc
� Manages the allocated memory regions
� Requests pages from the kernel
� Frees unused pages again
� therefore uses brk()/sbrk()
29
![Page 141: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/141.jpg)
Userspace Memory Management www.tugraz.at
brk and sbrk are complicated to use - let’s implement:
� malloc(size_t size)/free(void *p) in libc
� Manages the allocated memory regions
� Requests pages from the kernel
� Frees unused pages again
� therefore uses brk()/sbrk()
29
![Page 142: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/142.jpg)
Userspace Memory Management www.tugraz.at
brk and sbrk are complicated to use - let’s implement:
� malloc(size_t size)/free(void *p) in libc
� Manages the allocated memory regions
� Requests pages from the kernel
� Frees unused pages again
� therefore uses brk()/sbrk()
29
![Page 143: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/143.jpg)
Userspace Memory Management www.tugraz.at
� simple implementation:
doubly-linked list containing the memory regions
� Don’t forget about locking!
30
![Page 144: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/144.jpg)
Userspace Memory Management www.tugraz.at
� simple implementation:
doubly-linked list containing the memory regions
� Don’t forget about locking!
30
![Page 145: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/145.jpg)
Design / Submissions
![Page 146: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/146.jpg)
Design www.tugraz.at
Proof-of-Concept-Implementation as in Assignment 1
Recommendation: Start with swapping
31
![Page 147: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/147.jpg)
Design www.tugraz.at
Proof-of-Concept-Implementation as in Assignment 1
Recommendation: Start with swapping
31
![Page 148: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/148.jpg)
Alternative tasks www.tugraz.at
� Normal way: mandatory task virtual memory
� You want to go the normal way? Just ignore this slide...
� Alternative: Discuss with me about substituting the mandatory task with either security or
driver development as your new mandatory task
� This is not possible without discussing it with me!
32
![Page 149: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/149.jpg)
Alternative tasks www.tugraz.at
� Normal way: mandatory task virtual memory
� You want to go the normal way? Just ignore this slide...
� Alternative: Discuss with me about substituting the mandatory task with either security or
driver development as your new mandatory task
� This is not possible without discussing it with me!
32
![Page 150: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/150.jpg)
Alternative tasks www.tugraz.at
� Normal way: mandatory task virtual memory
� You want to go the normal way? Just ignore this slide...
� Alternative: Discuss with me about substituting the mandatory task with either security or
driver development as your new mandatory task
� This is not possible without discussing it with me!
32
![Page 151: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/151.jpg)
Alternative tasks www.tugraz.at
� Normal way: mandatory task virtual memory
� You want to go the normal way? Just ignore this slide...
� Alternative: Discuss with me about substituting the mandatory task with either security or
driver development as your new mandatory task
� This is not possible without discussing it with me!
32
![Page 152: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/152.jpg)
Submission www.tugraz.at
� As in Assignment 1
� Tags:
� Design/Proof-of-Concept: SubmissionD2
� Implementation: SubmissionI2
33
![Page 153: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/153.jpg)
Submission www.tugraz.at
� As in Assignment 1
� Tags:
� Design/Proof-of-Concept: SubmissionD2
� Implementation: SubmissionI2
33
![Page 154: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/154.jpg)
Submission www.tugraz.at
� As in Assignment 1
� Tags:
� Design/Proof-of-Concept: SubmissionD2
� Implementation: SubmissionI2
33
![Page 155: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/155.jpg)
Submission www.tugraz.at
� As in Assignment 1
� Tags:
� Design/Proof-of-Concept: SubmissionD2
� Implementation: SubmissionI2
33
![Page 156: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/156.jpg)
Deadlines www.tugraz.at
� Design-PoC: 11.12.2020, 18:00
� Individual feedback meetings ideally between 14.12. and 18.12.
� Implementation: 15.01.2021, 18:00
� Since 2011 we went to a pub after the implementation deadline
� Probably not this year :(
� We’re thinking about online alternatives...
34
![Page 157: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/157.jpg)
Deadlines www.tugraz.at
� Design-PoC: 11.12.2020, 18:00
� Individual feedback meetings ideally between 14.12. and 18.12.
� Implementation: 15.01.2021, 18:00
� Since 2011 we went to a pub after the implementation deadline
� Probably not this year :(
� We’re thinking about online alternatives...
34
![Page 158: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/158.jpg)
Deadlines www.tugraz.at
� Design-PoC: 11.12.2020, 18:00
� Individual feedback meetings ideally between 14.12. and 18.12.
� Implementation: 15.01.2021, 18:00
� Since 2011 we went to a pub after the implementation deadline
� Probably not this year :(
� We’re thinking about online alternatives...
34
![Page 159: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/159.jpg)
Deadlines www.tugraz.at
� Design-PoC: 11.12.2020, 18:00
� Individual feedback meetings ideally between 14.12. and 18.12.
� Implementation: 15.01.2021, 18:00
� Since 2011 we went to a pub after the implementation deadline
� Probably not this year :(
� We’re thinking about online alternatives...
34
![Page 160: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/160.jpg)
Deadlines www.tugraz.at
� Design-PoC: 11.12.2020, 18:00
� Individual feedback meetings ideally between 14.12. and 18.12.
� Implementation: 15.01.2021, 18:00
� Since 2011 we went to a pub after the implementation deadline
� Probably not this year :(
� We’re thinking about online alternatives...
34
![Page 161: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/161.jpg)
Deadlines www.tugraz.at
� Design-PoC: 11.12.2020, 18:00
� Individual feedback meetings ideally between 14.12. and 18.12.
� Implementation: 15.01.2021, 18:00
� Since 2011 we went to a pub after the implementation deadline
� Probably not this year :(
� We’re thinking about online alternatives...
34
![Page 162: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/162.jpg)
Design Discussions www.tugraz.at
� Next week (30.11.-04.12.)
� Like the one from Assignment 1
� Compulsory attendance
� Bring 2 pieces of paper with your name
� Repeating the assignment specification is not enough!
� Your design should be complete by that time
� Instant feedback
35
![Page 163: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/163.jpg)
Design Discussions www.tugraz.at
� Next week (30.11.-04.12.)
� Like the one from Assignment 1
� Compulsory attendance
� Bring 2 pieces of paper with your name
� Repeating the assignment specification is not enough!
� Your design should be complete by that time
� Instant feedback
35
![Page 164: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/164.jpg)
Design Discussions www.tugraz.at
� Next week (30.11.-04.12.)
� Like the one from Assignment 1
� Compulsory attendance
� Bring 2 pieces of paper with your name
� Repeating the assignment specification is not enough!
� Your design should be complete by that time
� Instant feedback
35
![Page 165: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/165.jpg)
Design Discussions www.tugraz.at
� Next week (30.11.-04.12.)
� Like the one from Assignment 1
� Compulsory attendance
� Bring 2 pieces of paper with your name
� Repeating the assignment specification is not enough!
� Your design should be complete by that time
� Instant feedback
35
![Page 166: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/166.jpg)
Design Discussions www.tugraz.at
� Next week (30.11.-04.12.)
� Like the one from Assignment 1
� Compulsory attendance
� Bring 2 pieces of paper with your name
� Repeating the assignment specification is not enough!
� Your design should be complete by that time
� Instant feedback
35
![Page 167: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/167.jpg)
Design Discussions www.tugraz.at
� Next week (30.11.-04.12.)
� Like the one from Assignment 1
� Compulsory attendance
� Bring 2 pieces of paper with your name
� Repeating the assignment specification is not enough!
� Your design should be complete by that time
� Instant feedback
35
![Page 168: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/168.jpg)
Design Discussions www.tugraz.at
� Next week (30.11.-04.12.)
� Like the one from Assignment 1
� Compulsory attendance
� Bring 2 pieces of paper with your name
� Repeating the assignment specification is not enough!
� Your design should be complete by that time
� Instant feedback
35
![Page 169: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/169.jpg)
Evaluations www.tugraz.at
� Tell us what was good and should remain the same
� Tell us what was bad and should be changed
36
![Page 170: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/170.jpg)
Evaluations www.tugraz.at
� Tell us what was good and should remain the same
� Tell us what was bad and should be changed
36
![Page 171: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/171.jpg)
Evaluations www.tugraz.at
� Tell us what was good and should remain the same
� Tell us what was bad and should be changed
36
![Page 172: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/172.jpg)
Evaluations www.tugraz.at
� Tell us what was good and should remain the same
� Tell us what was bad and should be changed
36
![Page 173: Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics Topics Presented Today: Mandatory: Virtual Memory (Copy On Write, Swapping) Shared](https://reader035.fdocuments.net/reader035/viewer/2022071508/6128f659d5396222442cd502/html5/thumbnails/173.jpg)