Title: Chap 6 O'S'
1Chap 6 O.S.
2Goal of O.S.
- (1) User-friendly
- (2) Efficiency
3Types of operating systems
- (1)Single-job system(2)Multiprogramming
system(3)Multiprocessing system(4)Batch
processing system(5)Timesharing
system(6)Real-time system
4Basic operating system functions
- (1)User interface
- (2)Run-time environment
5User interface
- It may include interactive prompting for
commands, or there may be a menu from which the
user selects various options
6Run-time environment 1/4
- (1) There service routines can be thought of as
defining an extended - machine for use by programs during execution.
7Run-time environment 2/4
- (2) On some systems, the user program can call
O.S. functions by - referring to fixed location in memory.
8Run-time environment 3/4
- (3) On more advanced systems, the user generally
request O.S. - functions by means of some special hardware
instruction such as - supervisor call (SVC).
9Run-time environment 4/4
- (4) Privileged instructions and user/supervisor
modes are a partial - necessity for a system that supports more than
one user at a time.
10Interrupt processing 1/4
- (1) SIC/XE interrupt types
Class interrupt type I
SVC II Program III
Timer IV I/O Fig
6.3
11Interrupt processing 2/4
- (2) The saving and restoring of the CPU status
and register contents are often referred to as
context switching operations.
12Interrupt processing 3/4
13SVC Interrupt work area
Program Interrupt work area
Timer Interrupt work area
I/O Interrupt work area
Fig 6.4 (a)
Fig 6.4 (b)
14Interrupt processing 4/4
- (4) SIC/XE status contents
- MODE dual mode,
- IDLE cpu state,
- ID process identifier,
- CC condition code,
- MASK interrupt mask flag,
- ICCODE indicate the cause of the interrupt.
15Fig 6.5
166.2.2 Process scheduling 1/5
- Process scheduling is the management of the cpu
by switching control among the various competing
processes according to some scheduling policy.
176.2.2 Process scheduling 2/5
- Process states
- 1. Ready state
- 2. Running state
- 3. Blocked state
186.2.2 Process scheduling 3/5
- Process state block (PSB)
- is used to save the required information for
state transition.
196.2.2 Process scheduling 4/5
- Dispatching methods
- 1. Round robin
- 2. Priority scheme
- 3. Preemptive v.s. nonpreemptive
206.2.2 Process scheduling 5/5
216.2.4 Management of real memory 1/5
- Fixed partition memory management
- 1. A simple allocation scheme using fixed
partitions loads each incoming job into the
smallest free partition in which it will fit. - 2. The initial selection of the partition sizes
is very important in fixed partition.
226.2.4 Management of real memory 2/5
- Variable partitions memory management
- 1. When variable partition used, it is not
necessary to select partition sizes in advance.
The operating system must do more work in keeping
track of which areas are free. - 2. Allocation methods first-fit, best-fit,
worse-fit, quick fit, buddy system.
236.2.4 Management of real memory 3/5
- Memory protection
- 1. Bounds register
- The values in bounds register are
automatically saved and restored during context
switching operations such as caused by an
interrupt or an LPS instruction. - 2. Storage protection key
- When a partition is assigned to a job, the
O.S. sets the storage for all blocks of memory
within the partition to the value of the process
identifier for that job.
246.2.4 Management of real memory 4/5
- Some problems to dynamic storage allocation
management -
- 1. Memory fragmentation problem
- -gt relocatable partitions
- -gt the coping of jobs from one location in
memory to another may require a substantial
amount of time. - 2. Program relocation problem
- -gt relocating a program during execution
- -gt It is more difficult than relocating it
when it is first loaded.
256.2.4 Management of real memory 5/5
- Hardware support
- 1. A relocation register that is set by the
operating system to contain the beginning address
of the program currently being executed. - 2. Note that this automatic relocation performed
by the hardware completely eliminates the need
for program relocation by the loader.
266.2.5 Management of virtual memory 1/7
- Basic concept of virtual memory
276.2.5 Management of virtual memory 2/7
1. Page, page frame, page map table(PMT). there
is one PMT entry for each page instead of one
relocation register for the entire program.
2. The conversion of virtual addresses of virtual
address to read address is know as dynamic
address translation (DAT).
Fig 6.25
286.2.5 Management of virtual memory 3/7
3. Page fault. page fault interrupt
Fig 6.22
296.2.5 Management of virtual memory 4/7
306.2.5 Management of virtual memory 5/7
- Algorithm for dynamic address translation and
- page fault interrupt
316.2.5 Management of virtual memory 6/7
- Some important features about virtual memory
- 1. Page replacement algorithm
- LRU least recently used
- FIFO first-in first-out
- NRU not recently used -not referenced and
not modified. - 2. Implementation of the page tables
- Central memory
- High speed buffer
- High speed associative memory
- 3. Thrashing (Working set model)
- 4. Segmentation (Shared library)
326.2.5 Management of virtual memory 7/7
Localized memory reference
Page-fault rate and localized reference
Fig 6.26
336.3 Machine-independent operating system features
346.3.1 File processing
1. The file-management function of an operating
system is an intermediate stage between the user
program and the I/O supervisor. 2. The catalog
relates logical file names to their physical
location and may give some basic information
about the files. 3. The file information table
for a file gives additional information such as
file organization, record length and format, and
indexing technique. 4. The blocking and buffering
operations on files being read or written is used
to save processing time and storage space. 5.
Double buffering technique is commonly introduced.
356.3.2 Job scheduling
1. Two-level scheduling scheme is used to limit
the multiprogramming level, which is the number
of user jobs sharing the CPU and the other system
resources. 2. Thrashing occurs when a job does
not have a certain critical number of pages in
memory, and the performance of the overall system
suffers. 3. Intermediate-level scheduler is
introduced to monitor system performance and
adjusts the multiprogramming level as needed to
prevent system from thrashing. 4. Scheduling
goals throughput , turnaround time , and
response time.
366.3.3 Resource allocation 1/4
1. The allocation of resources such as central
memory, I/O channels, and the CPU is handled
automatically by the operating system. Besides,
operating system will provide a facility to
control the allocation of user-defined resources
such as files and data structures.
376.3.3 Resource allocation 2/4
- 2. Critical section problems is introduced
- Mutual exclusion
- Progress
- Bounded waiting
Critical section
Process A
Process B
386.3.3 Resource allocation 3/4
3. Critical section problem can be prevented by
granting P1 OR P2 exclusive control of the stack
during the time it takes to perform the updating
operation.
396.3.3 Resource allocation 4/4
4. Unfortunately, the use of request and release
operations can lead to other types of problem is
called deadlock which means that a set of
processes each of which is permanently blocked
because of resources held by the others. 5. Once
a deadlock occurs, the only solution is to
release some of the resources currently being
held.
406.3.4 Protection 1/3
1. Access matrix is used to provide operating
system for protecting each user from unauthorized
actions by the others.
Fig 6.33
416.3.4 Protection 2/3
2. Since the access matrix is quite sparse, the
information concerning access rights is often
stored as an authorization list for each object,
or as a capability list for each user. 3. The
usual solution to the problem of that the
information must sometimes leave the secure
environment is data encryption.
426.3.4 Protection 3/3
4. The encryption and decryption operations can
be performed efficiently by either hardware or
software.
436.4 Operating system design options
446.4.1 Hierarchical structure
1. Operating system routines at given level use
the relatively simple functions and interfaces
provided by lower levels. 2. In a strict
hierarchy, each level may refer only to the level
immediately beneath, it. In a transparent
hierarchy each level may communicate directly
with the interface of any lower level.
456.4.2 Virtual machine
1. We can think of virtual machines as an
extension of the concept of multiprogramming down
to the lowest level of the operating system. 2. A
virtual machine monitor (VMM) provides each user
with the illusion of running on a separate
machine. 3. Each direct user of a virtual machine
actually runs in user mode, not supervisor
mode. 4. Advantage flexibility and
convenience 5. Disadvantage higher system
overhead to simulate virtual machine operations.
466.4.3 Multiprocessing systems
1. The only new function for a loosely coupled
multiprocessing system that must be performed is
the management of messages sent across the
communication links. 2. In a mater-slave
multiprocessing system, the processors can share
system resources such as memory and data files,
not them which make up the o.s. itself. 3. All
processor, have the ability to perform the same
sets of functions, the potential bottlenecks of a
master-slave system are avoided. Such type of
operation is called symmetric multiprocessing
system.