Αρχική ΑΕΠΠ - Δομές Δεδομένων Λειτουργικά Συστήματα Δίκτυα Υπολογιστών ΙΙ Βάσεις Δεδομένων Παιδαγωγικά - Διδακτική
Εισαγωγή στα Λ.Σ. Βασικές Δομές Η/Υ Βασικές Δομές Λ.Σ
Διεργασίες Χρονοπρογραμματισμός Συγχρονισμός
Μονοπρογραμματισμός Εναλλαγή Εικονική Μνήμη Κατάτμηση
Virtual memory can be a very interesting subject since it has so many different aspects: page faults, managing the backing store, page replacement, frame allocation, thrashing, page size. The objectives of this chapter are to explain these concepts and show how paging works. A simulation is probably the easiest way to allow the students to program several of the page replacement algorithms and see how they really work. If an interactive graphics display can be used to display the simulation as it works, the students may be better able to understand how paging works.
What is virtual memory?
A set of techniques and hardware allowing us to execute a program even when not entirely in memory.
List cases where entire program need not be in memory, traditionally.
Certain options of a program that are rarely used. Many error-handling sections. Large arrays, lists, and tables, where only a small portion is used.
List benefits of having only part of a program in memory.
What effect has virtual memory had on traditional program management?
Overlay methods have disappeared.
What is demand paging?
Design where a page is never swapped into memory unless needed.
List advantages of demand paging.
Decreases swap time and the amount of free physical memory, allows higher degree of multiprogramming.
Why is there a valid/invalid bit? Where is it kept?
To indicate whether an address is invalid, or a page is swapped out. It is kept in the page-frame table.
What is a page fault?
An interrupt caused by program needing a specific page not yet in memory.
List six steps to process a page fault.
Indicate states of instruction execution when a page fault occurs.
List two ways to resolve problem of instruction or data straddling two pages.
How do you compute the effective access time for a demand-page system?
Let p = probability of a page fault, t = memory access time, f = page-fault time. Then effective time = (1 - p) × t + p × f.
What factors determine the page-fault time?
List ways of resolving problem of no free frames left.
What is page replacement?
Selecting a frame (preferably not in use) as a victim; swap it out; swap in the desired page into this frame; restarting program.
How many swaps are needed for pure page replacement?
Two: first one out, second one in.
What does the modify (dirty) bit mean?
If set, the page has been modified, and must be written back to backing store before being used as a victim.
Ideally, what criteria should we use to replace pages?
Choose the victims to achieve the lowest page-fault rate.
We can judge page-replacement algorithms using what kind of data?
Reference strings: list of memory address references made by programs.
Describe FIFO as a page-replacement algorithm.
“First-in-First-out;” oldest page is chosen as victim, as determined by its position in a queue. Easy to understand; performance not always good.
What is Belady’s anomaly?
You’d expect that the page-fault rate would decrease as the number of frames increases; but Belady’s anomaly says this is not true in all algorithms.
What is the ideal page-replacement scheme?
OPTimal, or MINimum page-fault method. Replace the page that will not be used for the longest future time.
What are the uses and disadvantages of the OPT method?
It requires future knowledge of the reference string. It is used to compare with other methods.
What is the LRU algorithm?
Least recently used page is the victim of page replacement.
List ways to implement LRU, to determine which page is victim.
Does LRU require extra hardware?
Yes. Otherwise, system would spend more time selecting victims than in running programs.
What is the second-chance replacement method?
Pages are arranged in FIFO order, but have a reference bit. Oldest page is selected; if bit is clear, it is the victim. If bit is set, we clear it and look at next page.
What is the LFU method?
It keeps the number of references made to each page, and shifts the count right after regular intervals. Page with lowest count is victim.
List two ways of distributing frames among processes.
What problems occur with the above ways of distributing frames?
How do global and local allocation differ?
Local replacement: victim of replacement is in current process. Global replacement: victim of replacement selected from any process.
What is thrashing?
State where the system spends an excessive amount of time on paging, compared to the execution of processes.
What is meant by locality?
A set of pages which are actively used together.
What is a working set?
The set of pages referenced in the most recent time period delta, called the working set window.
What is the advantage of the working set model?
It allows you to determine a near optimum size for each process, and to allocate frames to prevent thrashing, yet with high degree of multiprogramming.
What is the page-fault frequency strategy?
Lower and upper levels of page-fault rates are specified. If a process faults more often than upper, it is given more frames; if it faults less than lower, frames are removed from it.
Why use prepaging?
Each process needs a minimum number of pages to run initially. Bring them in immediately to reduce paging later.
List factors determining the size of a page.
Illustrate the statement: “system performance can be improved by an awareness of the underlying demand paging.”
List two ways to treat memory swaps while waiting for I/O.
Describe another use of the lock bit. What danger is there here?
To prevent a newly swapped-in page from being swapped out before it can be used. The danger is that the bit may never get turned off, and the frame could become unusable.
What is the difference between a physical address and a virtual address?
Real memory uses physical addresses. These are the numbers that the memory chips react to on the bus. Virtual addresses are the logical addresses that refer to a process’ address space. Thus a machine with a 16-bit word can generate virtual addresses up to 64K, regardless of whether the machine has more or less memory than 64 KB.
Ένα υπολογιστικό σύστημα παρέχει στους χρήστες χώρο διευθύνσεων στην εικονική μνήμη των 232 bytes. Ο υπολογιστής έχει 218 bytes φυσικό χώρο διευθύνσεων. Η εικονική μνήμη χρησιμοποιεί σελιδοποίηση με μέγεθος σελίδας 4096 bytes. Μια διεργασία χρήση ζητάει την εικονική διεύθυνση 11123456. Εξηγείστε πως το σύστημα θα βρει την φυσική διεύθυνση για την παραπάνω εικονική.
Για τον χώρο των εικονικών διευθύνσεων χρησιμοποιούνται 32bit. Από αυτά τα 12bit είναι για το μέγεθος της σελίδας (4096=212). Τα υπόλοιπα 20bit χρησιμοποιούνται για τον πίνακα σελίδων.
Η εικονική διεύθυνση σε δυαδική μορφή είναι: 0001 0001 0001 0010 0011 0100 0101 0110
Τα 20 πρώτα bit μας δίνουν τον αριθμό σελίδας και τα υπόλοιπα 12 την μετατόπιση.
Αριθμός Σελίδας: 0001 0001 0001 0010 0011 = 69923(10) Μετατόπιση: 0100 0101 0110 = 1110(10)
Το σύστημα από τον πίνακα σελίδων θα βρει σε πιο πλαίσιο αντιστοιχεί η σελίδα. Το πλαίσιο αυτό θα αποτελέσει (σε δυαδική μορφή) τα πρώτα bits της φυσική διεύθυνσης και τα 12 τελευταία bits θα είναι αυτά της μετατόπισης.
Για κάθε μία από τις παρακάτω εικονικές διευθύνσεις (οι οποίες είναι σε δεκαδική μορφή), υπολόγισε την εικονική σελίδα και τη μετατόπιση (offset) για μέγεθος σελίδας 4Κ και 8Κ: 20000, 32768, 60000.
Για αναπαράσταση σελίδων των 4Κ χρειάζονται 12bit (212=4096). Οι σελίδες που δίνονται δεν ξεπερνούν το νούμερο 65536 το οποίο ισούτε με 216. Συμπεραίνουμε, λοιπόν, ότι οι διευθύνσεις έχουν 16bit εκ' των οποίων τα 4 χρησιμοποιούνται για τον αριθμό σελίδας και τα 12 για την μετατόπιση (offset). Με 4bit για τις σελίδες έχουμε συνολικά 24=16 σελίδες.
Η εικονική διεύθυνση 20000 δίνει:
Η εικονική διεύθυνση 32768 δίνει:
Η εικονική διεύθυνση 60000 δίνει:
Για σελίδες των 8K χρειάζονται 13bit (213=8192). Έτσι, για τις σελίδες έχουμε 3bit (16 - 13) και συνολικά 23=8 σελίδες.
Η εικονική διεύθυνση 20000 δίνει:
Η εικονική διεύθυνση 32768 δίνει:
Η εικονική διεύθυνση 60000 δίνει:
If an instruction takes 10 nsec and a page fault takes an additional n nsec, give a formula for the effective instruction time if page faults occur every k instructions.
A page fault every k instructions adds an extra overhead of n/k μsec to the average, so the average instruction takes 10 + n/k nsec.
A machine has a 32-bit address space and an 8-KB page. The page table is entirely in hardware, with one 32-bit word per entry. When a process starts, the page table is copied to the hardware from memory, at one word every 100 nsec. If each process runs for 100 msec (including the time to load the page table), what fraction of the CPU time is devoted to loading the page tables?
The page table contains 232/213 entries, which is 524,288. Loading the page table takes 52 msec. If a process gets 100 msec, this consists of 52 msec for loading the page table and 48 msec for running. Thus 52 percent of the time is spent loading page tables.
A computer with a 32-bit address uses a two-level page table. Virtual addresses are split into a 9-bit top-level page table field, an 11-bit second-level page table field, and an offset. How large are the pages and how many are there in the address space?
Twenty bits are used for the virtual page numbers, leaving 12 over for the offset. This yields a 212=4-KB page. Twenty bits for the virtual page implies 220 pages.
A computer has 32-bit virtual addresses and 4KB pages. The program and data together fit in the lowest page (0–4095) The stack fits in the highest page. How many entries are needed in the page table if traditional (one-level) paging is used? How many page table entries are needed for two-level paging, with 10 bits in each part?
For a one-level page table, there are 232/212 or 1M pages needed. Thus the page table must have 1M entries.
For two-level paging, the main page table has 210=1K entries, each of which points to a second page table. Only two of these are used. Thus in total only three page table entries are needed, one in the top-level table and one in each of the lower-level tables.
A machine has 48-bit virtual addresses and 32-bit physical addresses. Pages are 8 KB. How many entries are needed for the page table?
With 8-KB pages and a 48-bit virtual address space, the number of virtual pages is 248/213, which is 235 (about 34 billion).
Ένα σύστημα χρησιμοποιεί ως εικονικές διευθύνσεις 2048 σελίδες μεγέθους 256 bytes η κάθε μία και αντιστοιχείται σε μια φυσική μνήμη 512 πλαισίων. Η μικρότερη μονάδα προσπέλασης είναι 1 byte.
Σε ένα σύστημα που χρησιμοποιεί απλή σελιδοποίηση μία σελίδα αποτελείται από 1024 bytes. Το σύστημα έχει 8 εικονικές σελίδες και 4 πλαίσια. Ο πίνακας σελίδων σε κάποια χρονική στιγμή είναι :
Αριθμός Σελίδας | Αριθμός Πλαισίου |
---|---|
0 | 1 |
1 | 0 |
2 | 3 |
3 | - |
4 | - |
5 | 2 |
6 | - |
7 | - |
Λογική Διεύθυνση | Φυσική Διεύθυνση | |||||||
---|---|---|---|---|---|---|---|---|
v | p | d | f | d | a | |||
0 | => | 0 | 0 | => | 1 | 0 | => | 1024 |
3728 | => | 3 | 656 | => | - | 656 | => | page fault |
1023 | => | 0 | 1023 | => | 1 | 1023 | => | 2047 |
1024 | => | 1 | 0 | => | 0 | 0 | => | 0 |
1025 | => | 1 | 1 | => | 0 | 1 | => | 1 |
7800 | => | 7 | 632 | => | - | 632 | => | page fault |
4096 | => | 4 | 0 | => | - | 0 | => | page fault |
Ένας υπολογιστής παρέχει σε κάθε διεργασία χώρο διευθύνσεων 65536 bytes που διαιρείται σε σελίδων των 4096 bytes. Ένα συγκεκριμένο πρόγραμμα έχει ένα κείμενο μεγέθους 32768 bytes, δεδομένα μεγέθους 16386 bytes και μια στοίβα μεγέθους 15870 bytes. Θα μπορέσει αυτό το πρόγραμμα να χωρέσει στην μνήμη; Αν το μέγεθος της σελίδας ήταν 512 bytes, θα ταιριάζει; Θυμηθείτε ότι μια σελίδα δεν μπορεί να περιέχει κομμάτια δύο διαφορετικών τμημάτων.
Για σελίδες των 4096 bytes, χρειάζονται:
Συνολικά χρειάζεται 17 σελίδες. Στη μνήμη είναι διαθέσιμες 65536 / 4096 = 16 σελίδες. Άρα το πρόγραμμα δεν χωράει.
Για σελίδες των 512 bytes, χρειάζονται:
Συνολικά χρειάζεται 128 σελίδες. Στη μνήμη είναι διαθέσιμες 65536 / 512 = 128 σελίδες. Άρα το πρόγραμμα χωράει.
A computer whose processes have 1024 pages in their address spaces keeps its page tables in memory. The overhead required for reading a word from the page table is 5 nsec. To reduce this overhead, the computer has a TLB, which holds 32 (virtual page, physical page frame) pairs, and can do a look up in 1 nsec. What hit rate is needed to reduce the mean overhead to 2 nsec?
Ο τύπος που δίνει το μέσο χρόνο επίδοσης στη συσχετιστική μνήμη (TBL) δίνεται από τον τύπο:
Εδώ έχουμε: tp=5nsec, tc=1nsec, tμ=2nsec Κάνουμε αντικατάσταση:
Άρα το ποσοστό επιτυχίας πρέπει να είναι 80%.
If FIFO page replacement is used with four page frames and eight pages, how many page faults will occur with the reference string 0172327103 if the four frames are initially empty? Now repeat this problem for LRU.
0 1 7 2 3 2 7 1 0 3 | | 0 | 1 | 7 | 2 | 3 | 3 | 3 | 3 | 0 | 0 | | | | 0 | 1 | 7 | 2 | 2 | 2 | 2 | 3 | 3 | | | | | 0 | 1 | 7 | 7 | 7 | 7 | 2 | 2 | | | | | | 0 | 1 | 1 | 1 | 1 | 7 | 7 | P P P P P P
Συνολικά 6 λάθη σελίδας.
0 1 7 2 3 2 7 1 0 3 | | 0 | 1 | 7 | 2 | 3 | 2 | 7 | 1 | 0 | 3 | | | | 0 | 1 | 7 | 2 | 3 | 2 | 7 | 1 | 0 | | | | | 0 | 1 | 7 | 7 | 3 | 2 | 7 | 1 | | | | | | 0 | 1 | 1 | 1 | 3 | 2 | 7 | P P P P P P P
Συνολικά 7 λάθη σελίδας.
A small computer has four page frames. At the first clock tick, the R bits are 0111 (page 0 is 0, the rest are 1). At subsequent clock ticks, the values are 1011, 1010, 1101, 0010, 1010, 1100, and 0001. If the aging algorithm is used with an 8-bit counter, give the values of the four counters after the last tick.
Υπάρχουν δύο τρόποι για να βρούμε τους μετρητές.
1ο Τρόπος: Ξεκινάμε τους μετρητές από την αρχική κατάσταση (00000000) και για κάθε 4δα R bits, βάζουμε τα bit στους αντίστοιχους μετρητές
Σελίδα | Αρχική κατάσταση | R bits: 0111 | R bits: 1011 | R bits: 1010 | R bits: 1101 | R bits: 0010 | R bits: 1010 | R bits: 1100 | R bits: 0001 |
---|---|---|---|---|---|---|---|---|---|
0 | 00000000 | 00000000 | 10000000 | 11000000 | 11100000 | 01110000 | 10111000 | 11011100 | 01101110 |
1 | 00000000 | 10000000 | 01000000 | 00100000 | 10010000 | 01001000 | 00100100 | 10010010 | 01001001 |
2 | 00000000 | 10000000 | 11000000 | 11100000 | 01110000 | 10111000 | 11011100 | 01101110 | 00110111 |
3 | 00000000 | 10000000 | 11000000 | 01100000 | 10110000 | 01011000 | 00101100 | 00010110 | 10001011 |
2ος Τρόπος: Μπορούμε να βάλουμε τα R bits το ένα κάτω από το άλλο με αντίστροφη σειρά (από το τελευταίο προς το πρώτο). Τα bits της πρώτης στήλης αντιστοιχούν στη σελίδα 0, της δεύτερης στην 1 κ.ο.κ.
Μετρητές | ||||
---|---|---|---|---|
Σελίδα | 0 | 1 | 2 | 3 |
R bits | 0 | 0 | 0 | 1 |
1 | 1 | 0 | 0 | |
1 | 0 | 1 | 0 | |
0 | 0 | 1 | 0 | |
1 | 1 | 0 | 1 | |
1 | 0 | 1 | 0 | |
1 | 0 | 1 | 1 | |
0 | 1 | 1 | 1 |
Ένας υπολογιστής έχει τέσσερα πλαίσια σελίδας. Ο χρόνος φόρτωσης και τελευταίας προσπέλασης καθώς και οι τιμές των R μαι Μ bits. Δίνονται παρακάτω.
Σελίδα | Φόρτωση | Προσπέλαση | R | M |
---|---|---|---|---|
0 | 126 | 280 | 1 | 0 |
1 | 230 | 265 | 0 | 1 |
2 | 140 | 270 | 0 | 0 |
3 | 110 | 285 | 1 | 1 |
Ποια σελίδα θα αντικατασταθεί σύμφωνα με τους αλγόριθμους:
Στον παρακάτω πίνακα σελίδων ποια σελίδα θα αντικατασταθεί με βάση τον αλγόριθμο Working Set αν τ=400 και ο τρέχον εικονικός χρόνος είναι 2204;
Σελίδα | Χρόνος τελευταίας προσπέλασης | R bit |
---|---|---|
0 | 2084 | 1 |
1 | 2003 | 1 |
2 | 1980 | 1 |
3 | 1213 | 0 |
4 | 2014 | 1 |
5 | 2020 | 1 |
6 | 2032 | 1 |
7 | 1620 | 0 |
Ο αλγόριθμος αφαιρεί σελίδα η οποία έχει R=0 και ηλικία > τ (ηλικία = Τρέχον εικονικός χρόνος - Χρόνος τελευταίας προσπέλασης).
Η σελίδα με τον μικρότερο χρόνο και R=0 είναι η 3. Η ηλικία της είναι 2204-1213=991>400 άρα αφαιρείται.
Σ' ένα υπολογιστικό σύστημα το διάστημα ιδεατών διευθύνσεων έχει οχτώ σελίδες και η φυσική μνήμη έχει τέσσερα πλαίσια σελίδας. Μία διεργασία δημιουργεί την παρακάτω στοιχειοσειρά αναφορών:
0 2 1 3 5 4 6 3 7 4 7 3 3 5 5 3 1 1 1 7 1 3 4 1
Ο αλγόριθμος αντικατάστασης σελίδων που χρησιμοποιείται είναι ο LRU.
Μπορούμε να φανταστούμε έναν αφηρημένο διερμηνευτή ο οποίος ενημερώνει μία εσωτερική στοιχειοσειρά Μ που παρακολουθεί την κατάσταση της μνήμης. Η στοιχειοσειρά αυτή:
n
.
m
εγγραφές, περιέχει όλες τις σελίδες που βρίσκονται τη συγκεκριμένη χρονική στιγμή στη μνήμη. Αυτά είναι τα πλαίσια της φυσικής μνήμης.
n-m
εγγραφές, περιέχει όλες τις σελίδες στις οποίες έχει γίνει αναφορά τουλάχιστον μία φορά, αλλά έχουν απομακρυνθεί και δεν βρίσκονται πλέον στην μνήμη.
Ο διερμηνευτής δουλεύει ως εξής:
m
εγγραφές) τότε
m
εγγραφές), τότε
Ο αλγόριθμος LRU μπορεί να εξομοιωθεί με την ακόλουθη λογική:
Στοιχειοσειρά αναφορών: 0 2 1 3 5 4 6 3 7 4 7 3 3 5 5 3 1 1 1 7 1 3 4 1 1: | | 0 | 2 | 1 | 3 | 5 | 4 | 6 | 3 | 7 | 4 | 7 | 3 | 3 | 5 | 5 | 3 | 1 | 1 | 1 | 7 | 1 | 3 | 4 | 1 | 2: | | | 0 | 2 | 1 | 3 | 5 | 4 | 6 | 3 | 7 | 4 | 7 | 7 | 3 | 3 | 5 | 3 | 3 | 3 | 1 | 7 | 1 | 3 | 4 | 3: | | | | 0 | 2 | 1 | 3 | 5 | 4 | 6 | 3 | 3 | 4 | 4 | 7 | 7 | 7 | 5 | 5 | 5 | 3 | 3 | 7 | 1 | 3 | 4: | | | | | 0 | 2 | 1 | 3 | 5 | 4 | 6 | 6 | 6 | 6 | 4 | 4 | 4 | 7 | 7 | 7 | 5 | 5 | 5 | 7 | 7 | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ 5: | | | | | | 0 | 2 | 1 | 1 | 5 | 5 | 5 | 5 | 5 | 6 | 6 | 6 | 4 | 4 | 4 | 4 | 4 | 4 | 5 | 5 | 6: | | | | | | | 0 | 2 | 2 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 7: | | | | | | | | 0 | 0 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 8: | | | | | | | | | | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | Λάθη σελίδας: P P P P P P P P P P P Στοιχειοσειρά αποστάσεων: ∞ ∞ ∞ ∞ ∞ ∞ ∞ 4 ∞ 4 2 3 1 5 1 2 6 1 1 4 2 3 5 3
Η αίτηση για τη σελίδα 0 την εισάγει στην θέση ένα (1). Η σελίδα δεν υπήρχε σε καμία θέση, έτσι έχουμε λάθος σελίδας και ∞ στην στοιχειοσειρά αποστάσεων. Το ίδιο γίνεται και για τις σελίδες 2, 1, 3, 5, 4 και 6. Όταν γίνεται αίτηση για τη σελίδα 3, αυτή βρισκόταν στη θέση 4 η οποία ανήκει στη φυσική μνήμη (η οποία έχει 4 πλαίσια σύμφωνα με την εκφώνηση), έτσι δεν έχουμε λάθος σελίδας και στη στοιχειοσειρά αποστάσεων την τιμή 4. Η σελίδα μπαίνει στην θέση 0 και όσες βρίσκονταν από πάνω της ολισθένουν μία θέση κάτω. Οι επόμενες αιτήσεις εξυπηρετούνται όπως φαίνεται παραπάνω. Η δεύτερη αίτηση για τη σελίδα 5 τη βρίσκει στη θέση 5 η οποία δεν αντιστοιχεί σε πλαίσιο της φυσική μνήμης. Αυτό δημιουργεί λάθος σελίδας και στη στοιχειοσειρά αποστάσεων μπαίνει η τιμή 5. Οι υπόλοιπες αιτήσεις ακολουθούν την ίδια λογική.
Το διάνυσμα C έχει το πλήθος των εμφανίσεων της κάθε θέσης μνήμης στην στοιχειοσειρά αποστάσων. Το C1 έχει το πλήθος των σελίδων που ζητήθηκαν και βρίσκονταν στην 1η θέση μνήμης. Έτσι, από τη στοιχειοσειρά αποστάσεων έχουμε:
C1=4, C2=3, C3=3, C4=3, C5=2, C6=1, C7=0, C8=0, C∞=8
Το διάνυσμα F δίνεται από τον τύπο
Έχουμε, λοιπόν:
F1 = C2 + C3 + C4 + C5 + C6 + C7 + C8 + C∞ = 20
F2 = C3 + C4 + C5 + C6 + C7 + C8 + C∞ = 17
F3 = C4 + C5 + C6 + C7 + C8 + C∞ = 14
F4 = C5 + C6 + C7 + C8 + C∞ = 11
F5 = C6 + C7 + C8 + C∞ = 9
F6 = C7 + C8 + C∞ = 8
F7 = C8 + C∞ = 8
F8 = C∞ = 8
Το κάθε Fx δηλώνει εκτίμηση για τον αριθμό των λαθών σελίδας που θα έχουμε με βάση τη στοιχεισειρά αποστάσεων αν χρησιμοποιήσουμε x σελίδες. Δηλαδή, αν χρησιμοποιήσουμε 5 σελίδες, η εκτίμηση είναι F5=9 λάθη σελίδας.
Μια διεργασία παράγει την ακόλουθη στοιχειοσειρά αποστάσεων για μια μνήμη 5 πλαισίων και με τη χρήση του αλγόριθμου LRU:
∞ ∞ ∞ ∞ ∞ ∞ ∞ ∞ 4 2 2 4 3 4 3 5 2 3 2 4 2 4 3 2 3 2 4 6 1 2 3 5
Η διεργασία έχει 8 ιδεατές σελίδες στο διάστημα διευθύνσεών της. Υπολογίστε τα διανύσματα C και F για αυτή τη διεργασία. Πόσα λάθη σελίδας δημιούργησε;
C1=1, C2=8, C3=6, C4=6, C5=2, C6=1, C7=0, C8=0, C∞=8
F1 = C2 + C3 + C4 + C5 + C6 + C7 + C8 + C∞ = 31
F2 = C3 + C4 + C5 + C6 + C7 + C8 + C∞ = 23
F3 = C4 + C5 + C6 + C7 + C8 + C∞ = 17
F4 = C5 + C6 + C7 + C8 + C∞ = 11
F5 = C6 + C7 + C8 + C∞ = 9
F6 = C7 + C8 + C∞ = 8
F7 = C8 + C∞ = 8
F8 = C∞ = 8
Η μνήμη έχει 5 πλαίσια, άρα τα λάθη δίνονται από το F5, δηλαδή 9 λάθη.
Copyright 2008 - Άρης Φεργάδης