Computer Science 330
Operating Systems
Fall 2020, Siena College
Lecture 0x11: Allocation of Frames; Segmentation
Date: Monday, October 26, 2020
Agenda
- Announcements
- The next readings/activities from OS zyBook: Chapter 8, due Friday
- The next Term Project milestone is the proposal, due on Wednesday
- Programming Project 3: The Roger Bacon Shell [HTML] [PDF] discussion
- debug output is essential!
- ask for help sooner than you think you should, not later!
- In-class exercises for 20 lab points
- OS zyBook Exercise 7.2.1
- OS zyBook Exercise 7.2.2
- OS zyBook Exercise 7.3.2
- Frame allocation
- each process needs some number of frames
- pages for instructions, local data, global data
- how do we decide how many frames are allocated to each
process?
- equal allocation - everyone gets the same
- proportional allocation - processes get frames
proportional to the amount of logical memory
- priority allocation - prioritize memory like we
prioritize CPU scheduling
- local replacement vs. global replacement - does a victim
have to be selected from the page faulting process' frames?
- thrashing
- if we have too many processes, not enough frames to
keep a reasonably low page fault rate
- the medium-term scheduler may notice a low CPU
utilization (everyone's waiting on page faults) and add
more processes to the mix
- this will only make the situation worse
- need to be able to detect this and have the
medium-term or long-term scheduler reduce the degree of
multiprogramming
- Working set model
- each process will have a set of pages on which it is
working frequently at a given time
- this is the working set of a process
- a process' working set changes over time
- approximate the working set as the set of pages that
a process has accessed within some window of time into the
recent past
- if this working set window is too small, the working
set we detect will not encompass the true locality
- if it is too large, pages will remain in the working
set too long after the process has moved on
- total demand for frames in the system is the sum of
the working sets of all processes
- thrashing is likely when this total demand outstrips
availability
- this is used in reality in many modern systems
(Solaris, Windows, to name two)
- we will look more closely at this in a Friday lab exercise
- Segmentation
- like paging, but with variable-sized segments instead of
fixed-size frames
- allocate segments according to logical breakdown of memory
usage
- segment table requires base and offset
- external fragmentation can be a problem (as with the
contiguous allocation approach)
- Combinations of Segmentation and Paging
- Intel Pentium memory hardware