William Stallings Computer Organization and Architecture Chapter 7
- Slides: 41
William Stallings Computer Organization and Architecture Chapter 7 Operating System Support 1
Objectives and Functions z Convenience y. Making the computer easier to use z Efficiency y. Allowing better use of computer resources 2
Layers and Views of a Computer System 3
Operating System Services z Program creation z Program execution z Access to I/O devices z Controlled access to files z System access z Error detection and response z Accounting 4
O/S as a Resource Manager 5
Types of Operating System z Interactive z Batch z Single program (Uni-programming) z Multi-programming (Multi-tasking) 6
Early Systems z Late 1940 s to mid 1950 s z No Operating System z Programs interact directly with hardware z Two main problems: y. Scheduling y. Setup time 7
Simple Batch Systems z Resident Monitor program z Users submit jobs to operator z Operator batches jobs z Monitor controls sequence of events to process batch z When one job is finished, control returns to Monitor which reads next job z Monitor handles scheduling 8
Job Control Language z Instructions to Monitor z Usually denoted by $ z e. g. y$JOB y$FTN y. . . Some Fortran instructions y$LOAD y$RUN y. . . Some data y$END 9
Desirable Hardware Features z Memory protection y. To protect the Monitor z Timer y. To prevent a job monopolizing the system z Privileged instructions y. Only executed by Monitor ye. g. I/O z Interrupts y. Allows for relinquishing and regaining control 10
Multi-programmed Batch Systems z I/O devices very slow z When one program is waiting for I/O, another can use the CPU 11
Single Program 12
Multi-Programming with Two Programs 13
Multi-Programming with Three Programs 14
Time Sharing Systems z Allow users to interact directly with the computer yi. e. Interactive z Multi-programming allows a number of users to interact with the computer 15
Scheduling z Key to multi-programming z Long term z Medium term z Short term z I/O 16
Long Term Scheduling z Determines which programs are submitted for processing z i. e. controls the degree of multi-programming z Once submitted, a job becomes a process for the short term scheduler z (or it becomes a swapped out job for the medium term scheduler) 17
Medium Term Scheduling z Part of the swapping function (later…) z Usually based on the need to manage multiprogramming z If no virtual memory, memory management is also an issue 18
Short Term Scheduler z Dispatcher z Fine grained decisions of which job to execute next z i. e. which job actually gets to use the processor in the next time slot 19
Process States 20
Process Control Block z Identifier z State z Priority z Program counter z Memory pointers z Context data z I/O status z Accounting information 21
Key Elements of O/S 22
Process Scheduling Process Request Long-Term Queue Short-Term Queue CPU I/O I/O Queue End 23
Memory Management z Uni-program y. Memory split into two y. One for Operating System (monitor) y. One for currently executing program z Multi-program y“User” part is sub-divided and shared among active processes 24
Swapping z Problem: I/O is so slow compared with CPU that even in multi-programming system, CPU can be idle most of the time z Solutions: y. Increase main memory x. Expensive x. Leads to larger programs y. Swapping 25
What is Swapping? z Long term queue of processes stored on disk z Processes “swapped” in as space becomes available z As a process completes it is moved out of main memory z If none of the processes in memory are ready (i. e. all I/O blocked) y. Swap out a blocked process to intermediate queue y. Swap in a ready process or a new process y. But swapping is an I/O process. . . 26
Partitioning z Splitting memory into sections to allocate to processes (including Operating System) z Fixed-sized partitions y. May not be equal size y. Process is fitted into smallest hole that will take it (best fit) y. Some wasted memory y. Leads to variable sized partitions 27
Fixed Partitioning 28
Variable Sized Partitions (1) z Allocate exactly the required memory to a process z This leads to a hole at the end of memory, too small to use y. Only one small hole - less waste z When all processes are blocked, swap out a process and bring in another z New process may be smaller than swapped out process z Another hole 29
Variable Sized Partitions (2) z Eventually have lots of holes (fragmentation) z Solutions: y. Coalesce - Join adjacent holes into one large hole y. Compaction - From time to time go through memory and move all hole into one free block (c. f. disk defragmentation) 30
Effect of Dynamic Partitioning 31
Relocation z No guarantee that process will load into the same place in memory z Instructions contain addresses y. Locations of data y. Addresses for instructions (branching) z Logical address - relative to beginning of program z Physical address - actual location in memory (this time) z Automatic conversion using base address 32
Paging z Split memory into equal sized, small chunks page frames z Split programs (processes) into equal sized small chunks - pages z Allocate the required number page frames to a process z Operating System maintains list of free frames z A process does not require contiguous page frames z Use page table to keep track 33
Logical and Physical Addresses - Paging 34
Virtual Memory z Demand paging y. Do not require all pages of a process in memory y. Bring in pages as required z Page fault y. Required page is not in memory y. Operating System must swap in required page y. May need to swap out a page to make space y. Select page to throw out based on recent history 35
Thrashing z Too many processes in too little memory z Operating System spends all its time swapping z Little or no real work is done z Disk light is on all the time z Solutions y. Good page replacement algorithms y. Reduce number of processes running y. Fit more memory 36
Bonus z We do not need all of a process in memory for it to run z We can swap in pages as required z So - we can now run processes that are bigger than total memory available! z Main memory is called real memory z User/programmer sees much bigger memory virtual memory 37
Page Table Structure 38
Segmentation z Paging is not (usually) visible to the programmer z Segmentation is visible to the programmer z Usually different segments allocated to program and data z May be a number of program and data segments 39
Advantages of Segmentation z Simplifies handling of growing data structures z Allows programs to be altered and recompiled independently, without re-linking and re-loading z Lends itself to sharing among processes z Lends itself to protection z Some systems combine segmentation with paging 40
Required Reading z Stallings chapter 7 z Stallings, W. Operating Systems, Internals and Design Principles, Prentice Hall 1998 z Loads of Web sites on Operating Systems 41
- Computer arithmetic
- William stallings data and computer communications
- William stallings computer networks
- William stallings computer networks
- Network security essentials 5th edition
- Kr
- William stallings
- Congruence relation
- Stallings william comunicaciones y redes de computadores
- Cryptography william stallings
- Difference between computer architecture and organization
- Computer organization and architecture 10th solution
- Ripple carry adder virtual lab
- Introduction to computer organization and architecture
- Computer organization & architecture: themes and variations
- Computer organization and architecture 10th edition
- Computer organization and architecture definition
- 1 s complement
- Computer architecture and organization
- Process organization in computer organization
- Three bus architecture
- Instruction set architecture in computer organization
- Memory organisation in computer architecture
- Basic structure of a computer
- Design of basic computer with flowchart
- Flow chart for interrupt cycle
- Garbage collection stallings
- Stallings garbage pickup
- Apollo and daphne translation
- Metodo stallings
- Lh stallings
- Point by point organization essay
- Arm architecture and organization
- Computer organization and design ppt
- Basic computer organization and design
- Neumann dst
- System bus in computer
- Call and return architecture
- Components of information architecture
- Bapo business architecture process organization
- Timing and control in computer architecture
- Evolution and interpretation of computer architecture