Computer Science 330
Operating Systems
Fall 2020, Siena College
Lecture 0x0d: Synchronization Problems Recap; Memory Management
Date: Monday, October 12, 2020
Agenda
- Announcements
- OS zyBook: Chapter 6, due now but can still finish up this week
- The next readings/activities from OS zyBook: Chapter 7, due in a week
- Lab 7: Unix System Programming [HTML] [PDF], due
Wednesday, October 14, and it gives you examples of just about
everything you need for...
- Programming Project 3: The Roger Bacon Shell [HTML] [PDF] first
deadline is repository creation/group formation by Friday (but
you should get coding too)
- Last question of the midterm (classical problems of
synchronization) will be done in class on Friday
- Lab 6: Synchronization Problems
Practice [HTML] [PDF] recap
- Quick midterm exam recap
- One more Banker's Algorithm example
- Consider this resource allocation state for four different
non-preemptible resource types R0, R1, R2, and R3. Assume maximum
claims and current resource assignments for five processes P0, P1, P2,
P3, and P4, are given in the following table, along with the total
number of each resource available (not including allocated resources).
| Max Claims | Current Use | |
Resource | P0 | P1 | P2 | P3 | P4 | P0 | P1 | P2 | P3 | P4 | Avail |
R0 | 0 | 1 | 2 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 |
R1 | 0 | 7 | 3 | 6 | 6 | 0 | 0 | 3 | 6 | 0 | 5 |
R2 | 1 | 5 | 5 | 5 | 5 | 1 | 0 | 5 | 3 | 1 | 2 |
R3 | 2 | 0 | 6 | 2 | 6 | 2 | 0 | 4 | 2 | 4 | 0 |
|
Is this state safe?
- If a request arrives from process P1 for 4 instances of
R1 and 2 instances of R2, can the request be granted
immediately?
- Memory Management
- Binding time
- Programming or compile time
- Load time
- Execution time
- Logical vs. Physical Address Space
- Memory protection
- Swapping
- Contiguous allocation
- hardware support: limit and base/relocation registers
- first-fit/best-fit/worst-fit
- Fragmentation
- external: waste between allocated chunks
- internal: waste within allocated chunks
- reduce external fragmentation with a compaction operation
- Paging
- break up logical memory into pages, physical memory into frames
- page size: the size of these pages/frames
- can allow virtual memory
- translate addresses by looking up a frame number using
the page number, which is part of the logical address
- store the translations in a page table in memory
- a memory access now requires a page table access then
the memory access - slow!
- help: translation lookaside buffer - associative
memory that stores a subset of table entries
- TLBs are small, but locality helps it to have an
excellent hit rate in practice
- page table too large? page it - multilevel page
tables