Thrashing(12) Flashcards
Thrashing definition
occurs when processes do not have enough assigned memory page frames and the page fault rate is really high. Leads to low CPU utilization since the OS spends most time swapping pages between main and secondary storage
Relationship between degree of multi-programming vs CPU utilization
more multi-programming = more processes OS has scheduled to run = more time spent switching of of one process to accommodate another process
When does thrashing occur
lack of memory
over-commited memory
How to prevent thrashing
- ) local or priority page replacement
2. ) Dynamically allocate every process as many page frames as it needs - thrashing will not occur
Explain how local or priority page replacement can be used to prevent thrashing
Page frame allocation only occurs for a specific process so if one process starts thrashing it will not affect other processes currently scheduled to run
Issue with using local or priority page replacement to prevent thrashing
Doesnt stop N processes from thrashing independently at the same time
Explain temporal and spatial locality
for any given process only a few memory pages of the process are used during a small space of time and these pages tend to be close together in terms of memory address locations
Temporal - given location just referenced will likely be referenced again in near future
Spatial: if location was just referenced, nearby location swill likely be referenced
Working set definition
Its implied that memory references for a process tend to be grouped where groups of pages accessed along a given time slice are called a working set. Also defined minimum number of pages needed for a process to behave well.
Relationship between working set size, memory space and process performance
If working set size for each process is sufficiently less that the main mem size then good process performance else process could potentially thrash
Why does locality often occur
programs use loops that tend to reference arrays or other data structures by indices.
Sequential locality
special case of spatial locality - occurs when relevant data elements are arranged and accessed linearly
Equidistant locality
More general case
occurs when the linear traversal is over a longer area of adjacent data structures with identical structure and size accessing corresponding elements of the structure rather than each structure itself
e.g. matrix represented as sequential matrix of rows and the requirement is to access a single column of that matrix
How do working sets make us of logicality
OS only needs to keep recently referenced pages in memory
How does the working set model perform implicit load control
in many operating systems the size of the working set is changed dynamically as the memory demands of the process changes
how is the working set for each process estimated
0 is the start time of the working set, w is the size of the working set measured in the number of references. - process can only start if its been allocated w frames
assumes local replacement
also assumes that this method can keep track of working set size of each process and dynamically reallocated frames according to changing process demands