Download presentation
Presentation is loading. Please wait.
1
OS and the Computer System Some OS programs exist permanently in the system area of the memory to monitor and control activities in the computer system Other programs exist on a disk and are loaded in the transient area when needed. Remainder of the memory is occupied by user programs. ECEA
2
Computer System Fundamental features of computer systems that are important to an OS 1) The Central Processing Unit (CPU) 2) Memory hierarchy 3) Interrupt structure 4) I/O organization ECEA
3
Model of a Computer System ECEA
4
1)The Central Processing Unit (CPU) CPU contains two kinds of registers 1) General purpose registers Also called program-accessible registers Hold data, addresses, index values, or the stack pointer during execution of a program 1) Control registers Contain information that controls or influences operation of the CPU Set of control registers is called the program status word (PSW) ECEA
5
The Central Processing Unit (CPU) (continued) The program status word (PSW) is a collection of control registers in the systems: ECEA
6
The Central Processing Unit (CPU) (continued) CPU can operate in two modes 1) Kernel mode Can execute privileged instructions OS puts CPU in kernel mode when it is executing instructions in the kernel 2) User mode Cannot execute privileged instructions OS puts CPU in user mode while executing user programs Mode (M) field of PSW contains 0 if CPU is in kernel mode and 1 if it is in user mode ECEA
7
The Central Processing Unit (CPU) (continued) State of the CPU GPRs and PSW contain the information needed to know what the CPU is doing State of the CPU Kernel saves state of CPU when it takes away the CPU from program When program is to be resumed, it reloads the saved CPU state into GPRs and PSW ECEA
8
2)Memory hierarchy The memory hierarchy provides a large and fast memory, at a low cost It is an arrangement of several memory units with different access speeds and sizes The CPU accesses only the fastest memory; i.e., the cache If a required byte is not present in the memory being accessed, it is loaded there from a slower memory MMU ECEA
9
Memory hierarchy (continued) The MMU translate each memory address generated by the CPU into another address called the physical memory address MMU ECEA
10
Memory hierarchy (continued) Cache memory holds some instructions and data values that were recently accessed by the CPU Blocks of bytes (pages) are transferred from disk to cache memory Hit ratio(h): what fraction of bytes accessed by the CPU were found in the cache =h * Access time of cache memory + (1-h) * (t tra + Access time of cache memory ) MMU ECEA
11
Memory hierarchy (continued) Memory protection is implemented by checking whether a memory address used by a program lies outside the memory area allocated to it Two control registers used: LBR and UBR LBR and UBR registers contained in the memory protection information (MPI) field of PSW ECEA
13
3)Input/Output Subsystem Involvement of the CPU in I/O operations Should be the minimum possible due to imbalance between CPU and I/O speeds CPU should be free to execute instructions while I/O operations are in progress Different I/O modes 1) Programmed I/O 2) Interrupt I/O 3) Direct memory access (DMA) ECEA
15
4)Interrupts An interrupt signals the occurrence of an event to the CPU The CPU is diverted to execution of an OS routine Interrupt action saves CPU state and loads new contents into the PSW and GPRs CPU starts executing instructions of an interrupt servicing routine (ISR) in the kernel Different classes of interrupts convey occurrence of different kinds of events ECEA
16
Classes of Interrupts ECEA
17
OS Interaction with the Computer and User Programs Efficiency, System Performance, and User Convenience Classes of Operating Systems ECEA
18
OS Interaction with the Computer and User Programs 1) Controlling Execution of Programs 2) Interrupt Processing 3) System Calls Programs invoke the services of the OS through software interrupts The method to cause a software interrupt is known as a system call ECEA
19
1)Controlling Execution of Programs When user program starts, PSW should contain: 1) Program counter (PC) field contains the address of the first instruction in the program 2) Mode (M) field, set to user mode (1) 3) Memory protection information (MPI) field contains start address in memory and size of program 4) Interrupt mask (IM) field, set to enable all interrupts When program is interrupted, CPU state(PSW and GPRs) are saved in the program table When program is resumed, its CPU state is restored ECEA
20
2)Interrupt Processing Context save saves context of the CPU state so that the program that was being executed at the time of the interrupt can be resumed in future Context consists of CPU state and information concerning memory and resources used by the program The scheduling routine selects a program for execution ECEA
21
Interrupt Processing (continued) Nested interrupt Processing Two approaches for nested interrupt processing : 1. Disable nested interrupts through masking 2. Service more critical interrupts in a nested manner interruptible kernel ECEA
22
3)System Calls A system call is a request made by a program through a special instruction called a `software interrupt’ instruction The software interrupt is a program interrupt The operand of the software interrupt instruction indicates what kind of request is being made by a program ECEA
23
Efficiency, System Performance, and User Convenience A computing environment consists of a computer system, its interfaces with other systems, and the services provided by its operating system to its users and their programs 1) Nature of computation in an OS 2) Measuring Efficiency, System Performance, and User Convenience ECEA
24
1)Nature of computation in an OS Noninteractive Computing Environments OS focuses on efficient use of resources Computations in form of program or job Interactive Computing Environments OS focuses on reducing average amount of time required to implement an interaction between a user and his computation Execution of a program is called a process ECEA
25
Nature of computation in an OS (continued) ECEA
26
2)Measuring Efficiency, System Performance, and User Convenience Two of the fundamental goals of an OS: Efficiency of use Of a resource User convenience Measurable aspect: User service Turnaround time Response time To a system administrator, performance of a system in its environment is more important Typically measured as throughput ECEA
27
Measuring Efficiency, System Performance, and User Convenience (continued) ECEA
28
Classes of Operating Systems ECEA
29
Batch Processing Systems Batch: sequence of user jobs formed for processing by the OS Batching kernel initiates processing of jobs without requiring computer operator’s intervention Control statements used to protect against interference between jobs Command interpreter read a card when currently executing program in job wanted the next card ECEA
31
Multiprogramming Systems Provide efficient resource utilization in a noninteractive environment Uses DMA mode of I/O Can perform I/O operations of some program(s) while using the CPU to execute some other program Makes efficient use of both the CPU and I/O devices Turnaround time of a program is the appropriate measure of user service in these systems ECEA
32
Multiprogramming Systems (continued) ECEA
33
Multiprogramming Systems (continued) ECEA
34
Multiprogramming Systems (continued) An appropriate measure of performance of a multiprogramming OS is throughput Ratio of the number of programs processed and the total time taken to process them OS keeps enough programs in memory at all times, so that CPU and I/O devices are not idle Degree of multiprogramming: number of programs Uses an appropriate program mix of CPU-bound programs and I/O-bound programs Assigns appropriate priorities to CPU-bound and I/O-bound programs ECEA
35
Priority of Programs ECEA
36
Priority of Programs (continued) In multiprogramming environments, an I/O-bound program should have a higher priority than a CPU-bound program. ECEA
37
Performance of Multiprogramming systems How to improve performance? ECEA
38
Performance of Multiprogramming systems (continued) When an appropriate program mix is maintained, an increase in the degree of multiprogramming would result in an increase in throughput. ECEA
39
Time-Sharing Systems Provide a quick response to user subrequests Round-robin scheduling with time-slicing Kernel maintains a scheduling queue If time slice ( δ ) elapses before process completes servicing of a subrequest, kernel preempts it, moves it to end of queue, and schedules another process Implemented through a timer interrupt ECEA
40
Time-Sharing Systems (continued) ECEA
41
Time-Sharing Systems (continued) Response time (rt): measure of user service If processing of a subrequest requires δ CPU seconds rt = n × ( δ + σ ) η = δ / ( δ + σ ) where η : CPU efficiency, σ : scheduling overhead, n: number of users using system, δ : time required to complete a subrequest Actual response time would be different because Some users may be inactive Some programs may require > δ CPU seconds ECEA
42
Swapping allows the kernel to service more processes than can fit into the memory Improve system throughput and response times of processes Kernel performs swap-out and swap-in operations Swapping of Programs ECEA
43
Real-Time Operating Systems In real-time applications, users need computer to perform some actions in a timely manner To control activities in an external system, or to participate in them Timeliness depends on time constraints If application takes too long to respond to an activity, a failure can occur in the external system Response requirement Deadline: time by which action should be performed ECEA
44
Hard and Soft Real-Time Systems A hard real-time system meets response requirements under all conditions It is typically dedicated to processing real-time applications A soft real-time system makes best effort to meet response requirement of a real-time application Cannot guarantee that it will be able to meet it Meets requirements in a probabilistic manner E.g., multimedia applications ECEA
45
Distributed Operating Systems A distributed computer system consists of several individual computer systems connected through a network Each computer system could be a PC, a multiprocessor system, or a cluster Many resources of a kind exist in system This feature is used to provide the benefits summarized in Table 3.8 Handling network or individual computers’ failure requires special techniques Users must use special techniques to access resources over the network ECEA
46
Distributed Operating Systems (continued) ECEA
47
Special Techniques of Distributed Operating Systems ECEA
48
Summary A computing environment consists of a computer system, its interfaces with other systems, and the services provided by its OS to users and programs Evolved with advances in computer technology: Batch processing systems Multiprogramming operating system Priority-based scheduling Time-sharing operating systems Round-robin scheduling with time-slicing ECEA
49
Summary (continued) Evolution (continued) Real-time operating systems Priority-based scheduling and deadline-aware scheduling Distributed operating system Lets programs share resources across network ECEA
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.