Operating Systems - Assignment 2Operating Systems Assignment 2 Daniel Gruss November 25, 2020 Topics...

173
Operating Systems Assignment 2 Daniel Gruss November 25, 2020

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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