Presentation is loading. Please wait.

Presentation is loading. Please wait.

Review.

Similar presentations


Presentation on theme: "Review."— Presentation transcript:

1 Review

2 Virtual Memory That is Larger Than Physical Memory

3 Virtual-address Space

4 Demand Paging Bring a page into memory only when it is needed
Less I/O needed Less memory needed Faster response More users Page is needed  reference to it invalid reference  abort not-in-memory  bring to memory Lazy swapper – never swaps a page into memory unless page will be needed Swapper that deals with pages is a pager

5 Valid-Invalid Bit With each page table entry a valid–invalid bit is associated (v  in-memory, i  not-in-memory) Initially valid–invalid bit is set to i on all entries Example of a page table snapshot: During address translation, if valid–invalid bit in page table entry is I  page fault Frame # valid-invalid bit v v v v i …. i i page table

6 Page Table When Some Pages Are Not in Main Memory

7 Steps in Handling a Page Fault

8 Performance of Demand Paging
Page Fault Rate 0  p  1.0 if p = 0 no page faults if p = 1, every reference is a fault Effective Access Time (EAT) EAT = (1 – p) x memory access + p (page fault overhead + swap page out + swap page in + restart overhead )

9 Page Replacement Algorithms
Want lowest page-fault rate Evaluate algorithm by running it on a particular string of memory references (reference string) and computing the number of page faults on that string In all our examples, the reference string is 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5

10 Graph of Page Faults Versus The Number of Frames

11 FIFO Illustrating Belady’s Anomaly

12 Optimal Algorithm Replace page that will not be used for longest period of time 4 frames example 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 How do you know this? Used for measuring how well your algorithm performs 1 4 6 page faults 2 3 4 5

13 Least Recently Used (LRU) Algorithm
Reference string: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 Counter implementation Every page entry has a counter; every time page is referenced through this entry, copy the clock into the counter When a page needs to be changed, look at the counters to determine which are to change 1 1 1 1 5 2 2 2 2 2 3 5 5 4 4 4 4 3 3 3

14 Use Of A Stack to Record The Most Recent Page References

15 LRU Approximation Algorithms
Reference bit With each page associate a bit, initially = 0 When page is referenced bit set to 1 Replace the one which is 0 (if one exists) We do not know the order, however Second chance Need reference bit Clock replacement If page to be replaced (in clock order) has reference bit = 1 then: set reference bit 0 leave page in memory replace next page (in clock order), subject to same rules

16 Second-Chance (clock) Page-Replacement Algorithm

17 Counting Algorithms Keep a counter of the number of references that have been made to each page LFU Algorithm: replaces page with smallest count MFU Algorithm: based on the argument that the page with the smallest count was probably just brought in and has yet to be used

18 Thrashing (Cont.)

19 Buddy System Allocates memory from fixed-size segment consisting of physically-contiguous pages Memory allocated using power-of-2 allocator Satisfies requests in units sized as power of 2 Request rounded up to next highest power of 2 When smaller allocation needed than is available, current chunk split into two buddies of next-lower power of 2 Continue until appropriate sized chunk available

20 Buddy System Allocator

21 Chapter 10: File-System Interface

22 File Attributes Name – only information kept in human-readable form
Identifier – unique tag (number) identifies file within file system Type – needed for systems that support different types Location – pointer to file location on device Size – current file size Protection – controls who can do reading, writing, executing Time, date, and user identification – data for protection, security, and usage monitoring Information about files are kept in the directory structure, which is maintained on the disk

23 Tree-Structured Directories

24 Acyclic-Graph Directories
Have shared subdirectories and files

25 (a) Existing. (b) Unmounted Partition

26 Access Lists and Groups
Mode of access: read, write, execute Three classes of users RWX a) owner access 7  RWX b) group access 6  1 1 0 c) public access 1  0 0 1 Ask manager to create a group (unique name), say G, and add some users to the group. For a particular file (say game) or subdirectory, define an appropriate access. owner group public chmod 761 game Attach a group to a file chgrp G game

27 Chapter 11: File System Implementation

28 A Typical File Control Block

29 In-Memory File System Structures

30 Allocation Methods An allocation method refers to how disk blocks are allocated for files: Contiguous allocation Linked allocation Indexed allocation

31 Free-Space Management
Bit vector (n blocks) 1 2 n-1 0  block[i] free 1  block[i] occupied bit[i] =  Block number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit

32 Free-Space Management (Cont.)
Bit map requires extra space Example: block size = 212 bytes disk size = 230 bytes (1 gigabyte) n = 230/212 = 218 bits (or 32K bytes) Easy to get contiguous files Linked list (free list) Cannot get contiguous space easily No waste of space Grouping Counting

33 Free-Space Management (Cont.)
Need to protect: Pointer to free list Bit map Must be kept on disk Copy in memory and disk may differ Cannot allow for block[i] to have a situation where bit[i] = 1 in memory and bit[i] = 0 on disk Solution: Set bit[i] = 1 in disk Allocate block[i] Set bit[i] = 1 in memory

34 Log Structured File Systems
Log structured (or journaling) file systems record each update to the file system as a transaction All transactions are written to a log A transaction is considered committed once it is written to the log However, the file system may not yet be updated The transactions in the log are asynchronously written to the file system When the file system is modified, the transaction is removed from the log If the file system crashes, all remaining transactions in the log must still be performed

35 Snapshots in WAFL

36 Chapter 12: Mass-Storage Systems

37 Illustration shows total head movement of 640 cylinders.
FCFS Illustration shows total head movement of 640 cylinders.

38 SSTF (Cont.)

39 SCAN (Cont.)

40 C-SCAN (Cont.)

41 C-LOOK (Cont.)

42 RAID Levels

43 RAID levels block vs. byte parity distribution

44 Chapter 13: I/O Systems

45 Interrupt-Driven I/O Cycle

46 Block and Character Devices
Block devices include disk drives Commands include read, write, seek Raw I/O or file-system access Memory-mapped file access possible Character devices include keyboards, mice, serial ports Commands include get, put Libraries layered on top allow line editing

47 Two I/O Methods Synchronous Asynchronous

48 Life Cycle of An I/O Request

49 Chapter 14: Protection

50 Domain Structure Access-right = <object-name, rights-set> where rights-set is a subset of all valid operations that can be performed on the object. Domain = set of access-rights

51 Domain Implementation (MULTICS)
Let Di and Dj be any two domain rings. If j < I  Di  Dj

52 Modified Access Matrix of Figure B


Download ppt "Review."

Similar presentations


Ads by Google