Download presentation
Presentation is loading. Please wait.
Published bySybil Clark Modified over 9 years ago
1
COSC 4P13 Operating Systems : Design and Implementation
2
Course Description(1) u The Goals for this course u Understand UNIX u Understand Operating Systems u Prerequisites: u COSC 2P13 : Introduction to Operating Systems u COSC 2P91 : Procedural Programming u COSC 1P12 : Computer Organization and Assembly Language
3
Course Description(2) u An intensive study of computer operating system design u Multiprogramming u Time-sharing u Real-time processing u Job and task control u Synchronization of concurrent processes and processors u Resource scheduling u Protection u Management of hierarchical storage.
4
How to study this course u Read and remember u Read the book, remember the concepts and commands u Think u Think operating systems as natural administrative agents u Practice u Coding with UNIX, use and understand of UNIX commands and get the results
5
The Textbook Used u Uresh Vahalia, UNIX Internals: The New Frontiers, Prentice Hall, 1996 u Why we use this book? u UNIX is one of the popular operating systems of the world. u If you understand UNIX, you can understand other operating systems.
6
References u William Stallings, Operating Systems,4 th Ed., Prentice Hall,2000 u A. Tanenbaum, Modern Operating Systems, 2nd ed. Prentice Hall 2001 u Kay A. Robbins and Steven Robbins, Practical UNIX Programming, Prentice Hall,1996 u W. R. Stevens, Advanced Programming in the UNIX Environment, Addison Wesley, 1992
7
Operating System Overview u Computer System u Computer Hardware u Components u Registers u Instruction execution u Interrupt u Memory Hierarchy and I/O u Operating System u Services of OS u Major Achievements u Characteristics of Modern OS
8
Computer System End User Programmer Operating- System Designer Computer Hardware Operating-System Utilities Application Programs
9
Computer Hardware u Processor u Main Memory u referred to as real memory or primary memory u volatile u I/O modules u secondary memory devices u communications equipment u terminals u System interconnection u communication among processors, memory, and I/O modules
10
Computer Components: top-level view IR MAR MBR I/O AR I/O BR PC CPU Buffers I/O Module Memory Instruction Data.......... u MAR - Memory Address Register u address for next read or write u MBR - Memory Buffer Register u data to be written into memory u receives data read from memory u I/OAR - I/O Address u specifies a particular I/O device u I/OBR - I/O Buffer u exchange of data between an I/O module and the processor
11
I/O Module Structure u Data to/from system bus are buffered in data register(s) u Status/Control register(s) u I/O logic interact with CPU via control bus u Contains logic specific to the interface of each device
12
Processor Registers u User-visible registers u Data Registers u Address Registers u index register u segment pointer u stack pointer u Condition Codes or Flags u Control and Status Registers u Program Counter (PC) u Instruction Register (IR) u Program Status Word (PSW)
13
Instruction Execution u Processor executes instructions in a program u Instructions are fetched from memory one at a time START HALT Fetch Next Instruction Fetch Next Instruction Execute Instruction Execute Instruction Fetch CycleExecute Cycle
14
Instruction Fetch and Execute u The processor fetches the instruction from memory u Program counter (PC) holds address of the instruction to be fetched next u Program counter is incremented after each fetch
15
Instruction Register u Fetched instruction is placed here u Types of instructions u Processor-memory u transfer data between processor and memory u Processor-I/O u data transferred to or from a peripheral device u Data processing u arithmetic or logic operation on data u Control u alter sequence of execution
16
Interrupts u An interruption of the normal processing of processor u Improves processing efficiency u Allows the processor to execute other instructions while an I/O operation is in progress u A suspension of a process caused by an event external to that process and performed in such a way that the process can be resumed
17
Classes of Interrupts u Program u arithmetic overflow u division by zero u execute illegal instruction u reference outside user’s memory space u Timer u I/O u Hardware failure
18
Instruction Cycle with Interrupts START HALT Fetch Next Instruction Fetch Next Instruction Execute Instruction Execute Instruction Check for Interrupt: Process Interrupt Check for Interrupt: Process Interrupt Fetch CycleExecute CycleInterrupt Cycle Interrupts Disabled Interrupts Enabled
19
Interrupt Handler u A program that determines nature of the interrupt and performs whatever actions are needed u Control is transferred to this program u Generally part of the operating system
20
Interrupt Cycle u Processor checks for interrupts u If no interrupts fetch the next instruction for the current program u If an interrupt is pending, suspend execution of the current program, and execute the interrupt handler
21
Simple Interrupt Processing Device controller or other system hardware issues an interrupt Processor finishes execution of current instruction Processor signals acknowledgment of interrupt Processor pushes PSW and PC onto control stack Processor loads new PC value based on interrupt Save remainder of process state information Process interrupt Restore process state information Restore old PSW and PC
22
Interrupts improve CPU usage u I/O pgm prepares the I/O module and issues the I/O command (eg: to printer) u I/O pgm branches to user pgm u User code gets executed during I/O operation (eg: printing): no waiting u User pgm gets interrupted (x) when I/O operation is done and branches to interrupt handler to examine status of I/O module u Execution of user code resumes
23
u Disable interrupts during an interrupt u Interrupts remain pending until the processor enables interrupts u After interrupt handler routine completes, the processor checks for additional interrupts Multiple interrupts: sequential order
24
Multiple Interrupts: priorities u Higher priority interrupts cause lower-priority interrupts to wait u Causes a lower-priority interrupt handler to be interrupted u Example: when input arrives from communication line, it needs to be absorbed quickly to make room for more input
25
Cache/Main-Memory Structure Memory Address 1 3 0 2 2 n - 1 Block (k words) Word Length Slot Number TagBlock 0 2 1 C - 1 Block Length (k words) (a) Main Memory (b) Cache
26
Cache Design u Cache size u Block size u Mapping function u Replacement algorithm
27
I/O Techniques u Programmed I/O u Interrupt-Driven I/O u Direct Memory Access
28
Programmed I/O Insert Read command to I/O Module Read Status of I/O Module Check Status Read word from I/O Module Write word into memory Done? Yes No Next Instruction CPU Memory I/O CPU Error Condition I/O CPU CPU I/O Ready Not Ready u I/O module performs the action, not the processor u Sets appropriate bits in the I/O status register u No interrupts occur u Processor is kept busy checking status
29
Interrupt-Driven I/O Insert Read command to I/O Module Read Status of I/O Module Check Status Read word from I/O Module Write word into memory Done? Yes No Next Instruction CPU Memory I/O CPU Error Condition I/O CPU CPU I/O Ready Do something else Interrupt u Processor is interrupted when I/O module ready to exchange data u Processor is free to do other work u No needless waiting u Consumes a lot of processor time because every word read or written passes through the processor
30
Direct Memory Access Next Instruction CPU DMA Interrupt DMA CPU Do something else Issue Read block command to I/O module Read status of DMA module u Transfers a block of data directly to or from memory u An interrupt is sent when the task is complete u The processor is only involved at the beginning and end of the transfer
31
Operating System u Making computing power available to users by controlling the hardware u a program that controls execution of application programs u an interface between the user and hardware u Directs the processor in the use of system resources u Directs the processor when executing other programs
32
Services Provided by the OS u Facilities for Program creation u editors, compilers, linkers, and debuggers u Program execution u loading in memory, I/O and file initialization u Access to I/O and files u deals with the specifics of I/O and file formats u System access u Protection of access to resources and data u Resolves conflicts for resource contention
33
Services Provided by the OS u Error Detection u internal and external hardware errors u memory error u device failure u software errors u arithmetic overflow u access forbidden memory locations u Inability of OS to grant request of application u Error Response u simply report error to the application u Retry the operation u Abort the application
34
Services Provided by the OS u Accounting u collect statistics on resource usage u monitor performance (eg: response time) u used for system parameter tuning to improve performance u useful for anticipating future enhancements u used for billing users (on multiuser systems)
35
Operating System as a Resource Manager Processor...... Computer System I/O Controller Processor I/O Controller Memory Operating System Software Programs and Data OS Programs Data
36
Ability to Evolve u Must be able to adapt to hardware upgrades and new types of hardware. Examples: u Character vs graphic terminals u Introduction of paging hardware u Must be able to offer new services, eg: internet support
37
Major Achievements u Processes u Memory Management u Information protection and security u Scheduling and resource management u System structure
38
Memory Management u Process isolation u Automatic allocation and management u Support for modular programming u Protection and access control u Long-term storage
39
Virtual Memory u Allows programmers to address memory from a logical point of view u While program is running portions of the program and data are kept in blocks on disk
40
File System u Implements long-term store u Information stored in named objects called files
41
Categories of Security and Protection u Access control u regulate user access to the system u Information flow control u regulate flow of data within the system and its delivery to users u Certification u proving that access and flow control perform according to specifications
42
Scheduling and Resource Management u Fairness u give equal and fair access to all processes u Differential responsiveness u discriminate between different classes of jobs u Efficiency u maximize throughput, minimize response time, and accommodate as many uses as possible
43
Characteristics of Modern Operating Systems u Microkernel architecture u assigns only a few essential functions to the kernel u address space u interprocess communication (IPC) u basic scheduling
44
Characteristics of Modern Operating Systems u Multithreading u process u is divided into threads that can run simultaneously u Process is a collection of one or more threads u Thread u dispatchable unit of work u executes sequentially and is interruptable
45
Characteristics of Modern Operating Systems u Symmetric multiprocessing u there are multiple processors u these processors share the same main memory and I/O facilities u All processors can perform the same functions
46
Characteristics of Modern Operating Systems u Distributed operating systems u provides the illusion of a single main memory u used for distributed file system
47
Characteristics of Modern Operating Systems u Object-oriented design u used for adding modular extensions to a small kernel u enables programmers to customize an operating system without disrupting system integrity
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.