cs364 ch08 operating system support tech computer science operating system overview scheduling...
TRANSCRIPT
![Page 1: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/1.jpg)
CS364 CH08 Operating System Support
TECH Computer Science
• Operating System Overview• Scheduling• Memory Management• Pentium II and PowerPC Memory
Management
CH07
![Page 2: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/2.jpg)
Memory Management
• Uni-programMemory split into twoOne for Operating System (monitor)One for currently executing program
• Multi-program“User” part is sub-divided and shared among
active processes
![Page 3: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/3.jpg)
Swapping
• Problem: I/O is so slow compared with CPU that even in multi-programming system, CPU can be idle most of the time
• Solutions: Increase main memory
Expensive Leads to larger programs
Swapping
![Page 4: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/4.jpg)
What is Swapping?
• Long term queue of processes stored on disk• Processes “swapped” in as space becomes
available• As a process completes it is moved out of main
memory• If none of the processes in memory are ready
(i.e. all I/O blocked) Swap out a blocked process to intermediate queue Swap in a ready process or a new process But swapping is an I/O process...
![Page 5: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/5.jpg)
Partitioning
• Splitting memory into sections to allocate to processes (including Operating System)
• Fixed-sized partitionsMay not be equal sizeProcess is fitted into smallest hole that will
take it (best fit)Some wasted memoryLeads to variable sized partitions
![Page 6: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/6.jpg)
FixedPartitioning
![Page 7: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/7.jpg)
Variable Sized Partitions (1)
• Allocate exactly the required memory to a process
• This leads to a hole at the end of memory, too small to use Only one small hole - less waste
• When all processes are blocked, swap out a process and bring in another
• New process may be smaller than swapped out process
• Another hole
![Page 8: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/8.jpg)
Variable Sized Partitions (2)
• Eventually have lots of holes (fragmentation)
• Solutions:Coalesce - Join adjacent holes into one large
holeCompaction - From time to time go through
memory and move all hole into one free block (c.f. disk de-fragmentation)
![Page 9: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/9.jpg)
Effect of Dynamic Partitioning
![Page 10: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/10.jpg)
Relocation
• No guarantee that process will load into the same place in memory
• Instructions contain addresses Locations of data Addresses for instructions (branching)
• Logical address - relative to beginning of program• Physical address - actual location in memory (this
time)• Automatic conversion using base address
![Page 11: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/11.jpg)
Paging
• Split memory into equal sized, small chunks -page frames
• Split programs (processes) into equal sized small chunks - pages
• Allocate the required number page frames to a process
• Operating System maintains list of free frames• A process does not require contiguous page
frames• Use page table to keep track
![Page 12: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/12.jpg)
Allocation of page-frame
![Page 13: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/13.jpg)
Logical and Physical Addresses - Paging
![Page 14: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/14.jpg)
Virtual Memory (Demand Paging)
• Demand pagingDo not require all pages of a process in memoryBring in pages as required
• Page faultRequired page is not in memoryOperating System must swap in required pageMay need to swap out a page to make spaceSelect page to throw out based on recent history
![Page 15: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/15.jpg)
Thrashing
• Too many processes in too little memory• Operating System spends all its time
swapping• Little or no real work is done• Disk light is on all the time
• SolutionsGood page replacement algorithmsReduce number of processes runningFit more memory
![Page 16: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/16.jpg)
Bonus
• We do not need all of a process in memory for it to run
• We can swap in pages as required• So - we can now run processes that are
bigger than total memory available!
• Main memory is called real memory• User/programmer sees much bigger
memory - virtual memory
![Page 17: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/17.jpg)
Translation Lookaside Buffer
![Page 18: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/18.jpg)
Translation Lookaside Buffer
![Page 19: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/19.jpg)
TLB and Cache
![Page 20: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/20.jpg)
Segmentation
• Paging is not (usually) visible to the programmer
• Segmentation is visible to the programmer• Usually different segments allocated to
program and data• May be a number of program and data
segments
![Page 21: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/21.jpg)
Advantages of Segmentation
• Simplifies handling of growing data structures
• Allows programs to be altered and recompiled independently, without re-linking and re-loading
• Lends itself to sharing among processes• Lends itself to protection• Some systems combine segmentation
with paging
![Page 22: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/22.jpg)
Pentium II Memory Translation //
![Page 23: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/23.jpg)
Operating System Overview
• {Software/Hardware Interface}
• Unix, Dos, Mac, OS2, Windows, NT
![Page 24: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/24.jpg)
Objectives and Functions
• ConvenienceMaking the computer easier to use
• EfficiencyAllowing better use of computer resources
![Page 25: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/25.jpg)
Layers and Views of a Computer System
![Page 26: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/26.jpg)
Operating System Services
• Program creation• Program execution• Access to I/O devices• Controlled access to files• System access• Error detection and response• Accounting
![Page 27: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/27.jpg)
O/S as a Resource Manager
![Page 28: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/28.jpg)
Types of Operating System
• Interactive• Batch• Single program (Uni-programming)• Multi-programming (Multi-tasking)
![Page 29: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/29.jpg)
Early Systems
• Late 1940s to mid 1950s• No Operating System• Programs interact directly with hardware• Two main problems:
SchedulingSetup time
![Page 30: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/30.jpg)
Simple Batch Systems
• Resident Monitor program• Users submit jobs to operator• Operator batches jobs• Monitor controls sequence of events to
process batch• When one job is finished, control returns
to Monitor which reads next job• Monitor handles scheduling
![Page 31: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/31.jpg)
Job Control Language
• Instructions to Monitor• Usually denoted by $• e.g.
$JOB $FTN ... Some Fortran instructions $LOAD $RUN ... Some data $END
![Page 32: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/32.jpg)
Desirable Hardware Features
• Memory protectionTo protect the Monitor
• TimerTo prevent a job monopolizing the system
• Privileged instructionsOnly executed by Monitore.g. I/O
• InterruptsAllows for relinquishing and regaining control
![Page 33: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/33.jpg)
Multi-programmed Batch Systems
• I/O devices very slow• When one program is waiting for I/O,
another can use the CPU
![Page 34: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/34.jpg)
Single Program
![Page 35: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/35.jpg)
Multi-Programming with Two Programs
![Page 36: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/36.jpg)
Multi-Programming with Three Programs
![Page 37: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/37.jpg)
Time Sharing Systems
• Allow users to interact directly with the computer i.e. Interactive
• Multi-programming allows a number of users to interact with the computer
![Page 38: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/38.jpg)
Scheduling (CPU management)
• Key to multi-programming• Long term• Medium term• Short term• I/O
![Page 39: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/39.jpg)
Long Term Scheduling
• Determines which programs are submitted for processing
• i.e. controls the degree of multi-programming
• Once submitted, a job becomes a process for the short term scheduler
• (or it becomes a swapped out job for the medium term scheduler)
![Page 40: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/40.jpg)
Medium Term Scheduling
• Part of the swapping function (later…)• Usually based on the need to manage
multi-programming• If no virtual memory, memory
management is also an issue
![Page 41: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/41.jpg)
Short Term Scheduler
• Dispatcher• Fine grained decisions of which job to
execute next• i.e. which job actually gets to use the
processor in the next time slot
![Page 42: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/42.jpg)
Process States
![Page 43: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/43.jpg)
Process Control Block
• Identifier• State• Priority• Program counter• Memory pointers• Context data• I/O status• Accounting information
![Page 44: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/44.jpg)
Key Elements of O/S
![Page 45: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/45.jpg)
Process Scheduling
Process
Request
EndLong-TermQueue
Short-Term
QueueCPU
I/O QueueI/O
I/O QueueI/O
I/O QueueI/O
![Page 46: CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management](https://reader035.vdocument.in/reader035/viewer/2022062516/56649da15503460f94a8c99d/html5/thumbnails/46.jpg)
Required Reading
• Stallings chapter 7• Stallings, W. Operating Systems, Internals
and Design Principles, Prentice Hall 1998• Loads of Web sites on Operating Systems