Beruflich Dokumente
Kultur Dokumente
Chapter 1: Introduction
What Operating Systems Do Computer-System structure Operating-System Structure Operating-System Operations Process Management Memory Management Storage Management Protection and Security
1.2
1.3
1.4
1.5
1.6
1.7
1.8
Computer-System Operation
I/O devices and the CPU can execute concurrently. Each device controller is in charge of a particular device type. Each device controller has a local buffer. CPU moves data from/to main memory to/from local buffers I/O is from the device to local buffer of controller. Device controller informs CPU that it has finished its operation by causing an interrupt.
1.9
Computer Startup
bootstrap program is loaded at power-up or reboot
Typically stored in ROM or EPROM (Erasable Programmable Read-Only Memory) , generally known as firmware. Initializates all aspects of system from CPU to registers to device controllers to memory contents. Loads operating system kernel into memory and starts execution the first process such init and waiting for some event to occur.
1.10
Computer Startup (cont.) The occurrence of an event is signaled by an interrupt from either the hardware or the software. Hardware may trigger an interrupt at any time by sending a signal to the CPU by way of the system bus. Software triggers an interrupt by executing a special operation called a system call ( or monitor call)
1.11
Interrupt Handling
When the CPU is interrupted, it stops what is doing and immediately transfer execution to the starting address where the service routine for the interrupt is located. The interrupt service routine executes; on completion, the CPU resumes the interrupted computation.
1.12
1.13
Common Functions of Interrupts (cont.) Incoming interrupts are disabled while another interrupt is being processed to prevent a lost interrupt. A trap is a software-generated interrupt caused either by an error or a user request. An operating system is interrupt driven.
1.14
1.15
1.16
1.17
Time-sharing and multiprogramming require several jobs to be kept simultaneously in memory. The jobs are kept initially in the job pool (the pool consists of all processes residing on disk awaiting allocation of main memory) If several jobs ready to run at the same time > CPU scheduling. When the OS selects a job from the pool it loads that job into memory for execution Having several programs in memory at the same time requires some form of memory management
1.18
If processes dont fit in memory, swapping moves them in and out to run Virtual memory allows execution of processes not completely in memory. It enables users to run programs that are larger than the actual physical memory. Time-sharing systems must also provide a file system. The file system resides on a collection of disks. Disk management must be provided Time-sharing systems provide a mechanism for protecting resources from inappropriate use.
1.19
Operating-System Operations
Modern operating systems are Interrupt driven. Events are signaled by the occurrence of an interrupt (hardware) or a trap. a trap ( or exception) is a software-generated interrupt caused either by: an error ( e.g. Division by zero), or a specific request from a user program for operating system service. For each type of interrupt, an interrupt service routine is provided that is dealing with the interrupt.
1.20
Operating-System Operations
With Sharing, many processes could be affected by a bug in one program ( e.g. process problems include infinite loop, processes modifying each other or the operating system). A properly designed operating system must insure that an incorrect program cannot cause other programs to execute incorrectly.
1.21
Operating-System Operations
Dual-mode operation : allows OS to protect itself and other system components. To distinguish between the execution of operating system code and user code, we need two separate modes of operations: User mode, and kernel mode (supervisor mode , system mode)
1.22
Operating-System Operations Mode bit provided by hardware Provides ability to distinguish when system is running user code or kernel code ( 0 (kernel mode , 1 (user mode) ) At system boot time, the hardware starts in kernel mode. The OS is then loaded and starts user applications in user mode. When a user application requests a service from the operating system via a system call, it must transition from user to kernel mode to fulfill the request.
1.23
Operating-System Operations
Some instructions that may cause harm are designated as privileged, only executable in kernel mode System call changes mode to kernel, return from call resets it to user
1.24
Operating-System Operations
1.25
1.26
Process Management
A process is a program in execution. It is a unit of work within the system: A word-processing program being run by an individual user on a PC is a process. A system task, such as sending output to a printer can also be a process or part of it Program (contents of a file stored on disk) is a passive entity, process is an active entity. Process needs resources to accomplish its task CPU, memory, I/O, files Initialization data Process termination requires reclaim of any reusable resources
1.27
Process Management
Single-threaded process has one program counter specifying location of next instruction to execute Process executes instructions sequentially, one at a time, until completion Multi-threaded process has one program counter per thread Typically system has many processes, some user, some operating system running concurrently on one or more CPUs Concurrency by multiplexing the CPUs among the processes / threads
1.28
1.29
Memory Management
All instructions in memory in order to execute Memory management activities Keeping track of which parts of memory are currently being used and by whom Deciding which processes (or parts thereof) and data to move into and out of memory Allocating and deallocating memory space as needed
1.30
Storage Management
Computer can store data on several different types of physical media. Each medium is controlled by device (i.e., disk drive, tape drive) that has its own characteristics. Varying properties include access speed, capacity, data-transfer rate, access method (sequential or random) OS activities include in connection with file management: Creating and deleting files and directories Primitives to manipulate files and dirs Mapping files onto secondary storage Backup files onto stable (non-volatile) storage media
1.31
Caching
storing parts of data in faster storage for performance Information in use copied from slower to faster storage temporarily Faster storage (cache) checked first to determine if information is there If it is, information used directly from the cache (fast) If not, data copied to cache and used there
1.32
I/O Subsystem
One purpose of OS is to hide characteristics of hardware devices from the user I/O subsystem responsible for Memory management of I/O including: buffering (storing data temporarily while it is being transferred), caching (storing parts of data in faster storage for performance), spooling (the overlapping of output of one job with input of other jobs)
1.33
1.34
1.35
End of Chapter 1