Você está na página 1de 71

CPIT260 Operating Systems Ch1 :Introduction

CPIT260 Spring 2013 Instructor: Ms. Bushra Abdullah Al-Anesi

Operating System Concepts 8th Edition , Silberschatz, Galvin,

Objectives
Understand the relationship between the computer system

and operating system Understand the mechanism of interrupts and how it is used within a computer system Specify the role of an operating system and its core modules - process management, memory management, I/O systems, protection and security. Understand how these modules interact among themselves and how they interact with the computer system

Operating System Concepts 8th Edition , Silberschatz, Galvin,

Chapter 1: Introduction
What Operating Systems Do Computer-System Organization Computer-System Architecture Operating-System Structure Operating-System Operations Process Management Memory Management

Storage Management
Protection and Security Distributed Systems Special-Purpose Systems

Computing Environments
Open-Source Operating Systems

Operating System Concepts 8th Edition , Silberschatz, Galvin,

What is an Operating System (User View)?


A program that acts as an intermediary (interface)

between a user of a computer and the computer hardware Operating system goals:(Why)
Execute user programs and make solving user problems

Operating System Concepts 8th Edition , Silberschatz, Galvin,

easier Make the computer system convenient to use: It provides a user-friendly environment in which a user may easily develop and execute programs. Otherwise, hardware knowledge would be mandatory for computer programming. An OS hides the complexity of hardware from uninterested users. Use the computer hardware in an efficient manner:

What is an operating system (Technical view)

A program that runs on the raw hardware and supports Resource Abstraction (different hardware but same interface) Resource Sharing (for multi-programming case) Abstracts and standardizes the interface to the user

across different types of hardware


Device independent (all network cards look the same)

Manages the hardware resources Each program gets time with the resource (CPU) Each program gets space on the resource(MEM) May have potentially conflicting goals: Use hardware efficiently Give maximum performance to each user

Operating System Concepts 8th Edition , Silberschatz, Galvin,

Computer System Structure (where?) (structural view)


Computer system can be divided into four components Hardware provides basic computing resources CPU, memory, I/O devices Operating system Controls and coordinates use of hardware among

various applications and users System and Application programs define the ways in which the system resources are used to solve the computing problems of the users Word processors, compilers, web browsers, database systems, video games Users People, machines, other computers
Operating System Concepts 8th Edition , Silberschatz, Galvin,
6

Abstract View of a Computer System: Four Components of a Computer System


User 1 User 2 User 3

...

User n

compiler

assembler

Text editor

System and Application Programs


Operating System
Computer Hardware
Operating System Concepts 8th Edition , Silberschatz, Galvin,
7

Database system

Operating System Definition (how) (managerial view)


OS is a resource allocator (servant)

Manages all resources: CPU time, memory

space, file storage I/O devices, Decides between conflicting requests for efficient and fair resource use (contradicting goals). OS is a control program (governor) Controls execution of programs to prevent errors and improper use of the computer. Ex: a program may write into other program area or on operating system memory, or accesses desk directly, divide by 0, etc.
Operating System Concepts 8th Edition , Silberschatz, Galvin,

Operating System Definition (which)


No universally accepted definition

Everything a vendor ships when you order an operating

system is good approximation But varies wildly The one program running at all times on the computer is the kernel. Everything else is either a system program (ships with the operating system used ondemand: e.g. compilers) or an application program.
Application Programs

System Programs

Operating System (Kernel) HARDWARE


Operating System Concepts 8th Edition , Silberschatz, Galvin,
9

3 Main Purposes Of An Operating System


To provide an environment for a computer user to

execute programs on computer hardware in a convenient and efficient manner. To allocate the separate resources of the computer as needed to solve the problem given. The allocation process should be as fair and efficient as possible. As a control program it serves two major functions: (1) supervision of the execution of user programs to prevent errors and improper use of the computer, and (2) management of the operation and control of I/O devices.
Operating System Concepts 8th Edition , Silberschatz, Galvin,
10

Computer Startup(when)
bootstrap program is loaded at power-up or

reboot Typically stored in ROM or EPROM, generally known as firmware Initializes all aspects of system (CPU registers, memory, I/O device controllers,etc.) Loads operating system kernel and starts its execution.

Operating System Concepts 8th Edition , Silberschatz, Galvin,

11

Computer System Organization


Computer-system operation One or more CPUs, device controllers connect through common bus

providing access to shared memory. Concurrent execution of CPUs and devices competing for memory cycles.

Operating System Concepts 8th Edition , Silberschatz, Galvin,

12

Components of a simple PC
Outside world

Video controller

Hard drive controller

USB controller

Network controller

CPU Memory
Operating System Concepts 8th Edition , Silberschatz, Galvin,

Computer internals (inside the box)


13

Interrupts
Defn: an event external to the currently

executing process that causes a change in the normal flow of instruction execution; usually generated by hardware devices external to the CPU
From Design and Implementation of the FreeBSD Operating System, Glossary

Key point is that interrupts are asynchronous

w.r.t. current process


Typically indicate that some device needs service
Operating System Concepts 8th Edition , Silberschatz, Galvin,
14

Why Interrupts?
People like connecting devices A computer is much more than the CPU

Keyboard, mouse, screen, disk drives


Scanner, printer, sound card, camera, etc. These devices occasionally need CPU service

But we cant predict when


External events typically occur on a macroscopic

timescale we want to keep the CPU busy between events Need a way for CPU to find out which devices need attention
Operating System Concepts 8th Edition , Silberschatz, Galvin,
15

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 I/O is from the device to local buffer of controller CPU moves data from/to main memory to/from local buffers Device controller informs CPU that it has finished its operation by causing an interrupt Protocol: To get a byte of data from a device
1. CPU sets registers in controller with command to read e.g.

character from modem. 2. I/O is from the device to local buffer of controller 3. Device controller CPU that it has finished its operation Operating System Concepts 8th Edition informs , Silberschatz, Galvin,

16

Polling vs Interrupts
Mario (CPU) and Princess Peach (I/O Device) VIDEO

Operating System Concepts 8th Edition , Silberschatz, Galvin,

Possible Solution: Polling


CPU periodically checks each device to see if it

needs service takes CPU time even when no requests pending overhead may be reduced at expense of response time can be efficient if events arrive rapidly

Polling is like picking up your phone every few seconds to see if you have a call.
Operating System Concepts 8th Edition , Silberschatz, Galvin,
18

Alternative: Interrupts
Give each device a wire (interrupt line) that it

can use to signal the processor When interrupt signaled, processor executes a routine called an interrupt handler to deal with the interrupt No overhead when no requests pending

Operating System Concepts 8th Edition , Silberschatz, Galvin,

Details are architecture dependent!

19

Polling vs. Interrupts


Interrupts win if processor has other work to

do and event response time is not critical

Operating System Concepts 8th Edition , Silberschatz, Galvin,

20

Interrupt Handling
Interrupts are issued by 1. an external event raised by hardware: e.g. I/0 2. an internal event trigger by software: e.g. system calls (means application needs a service from the OS. It calls a service). TRAP Interrupt Handler (service routine) ISR a subroutine in the operating system to process a particular type of interrupt
Interrupt Vector an array of starting addresses of interrupt handlers The index for a particular interrupt to the array is provided by the hardware. ISR
(printer) ISR (Keyboard)

Interrupt Memory Operating System ConceptsVector 8th Edition , Silberschatz, Galvin,

21

Hardware Interrupt Handling


Interrupt controller signals CPU that interrupt has

occurred, passes interrupt number


Interrupts are assigned priorities to handle simultaneous

interrupts Lower priority interrupts may be disabled during service


CPU senses (checks) interrupt request line after every

instruction; if raised, then:


uses interrupt number to determine which handler to start interrupt vector associates handlers with interrupts Separate segments of code determine what action should be taken for each type of interrupt (interrupt service routine)

Basic program state saved (as for system call) CPU jumps to interrupt handler When interrupt done, program state reloaded and
Operating System Concepts 8th Edition , Silberschatz, Galvin,

program resumes

22

Common Functions of Interrupts


Interrupt transfers control to the interrupt service routine

generally, through the interrupt vector, which contains the addresses of all the service routines Interrupt architecture must save the address of the interrupted instruction 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

Operating System Concepts 8th Edition , Silberschatz, Galvin,

23

I/O Techniques
Programmed I/O: processor interacts with I/O module directly issues I/O commands to I/O module interrogates status bits repeatedly (Polling) reads or writes: transfers the data between CPU and I/O module Interrupt-Driven I/O: I/O module interrupts when I/O module

is ready
issues I/O commands to I/O module
goes off to run other processes (doing something else) get interrupted when I/O module is ready and reads or writes (in

interrupt handlers)

Direct Memory Access (DMA): A separate module called

DMA module takes care of the interrupt from I/O and data transfer
Processor sends request to DMA (starting address, number of bytes,

address of I/0 device, read or write) Operating System Concepts with 8th Edition Silberschatz, Galvin, DMA interacts I/O ,module and completes the bulk transfer

24

Interrupt driven I/O


Each device controller has a buffer and some registers For each device controller there is a SW device driver To read data from the device, the device driver is called

through OS system calls. The device driver sets appropriate control registers for the device controller to start transferring data from the device to the device local buffer. After completion of data transfer, the controller sends an interrupt which is recognized by the driver. The device driver transfers data from the device buffer to the computer memory. The driver returns control to the operating system (or user program) with actual data read from the device local buffer or a pointer to the data. Example :Keyboard device (slow device) doesn't cause many interrupts: Operating System Concepts 8th Edition , Silberschatz, Galvin, Interrupt per key press: say 50 interrupts/second

25

Device drivers
Device drivers go between
User space Kernel space
Rest of the OS User program

device controllers and rest of OS


Drivers standardize interface to

widely varied devices

Device drivers communicate

with controllers over bus


Controllers

communicate with devices themselves

Keyboard driver

Disk driver

Keyboard controller

Disk controller

26

Anatomy of a device request


Instructionn Instructionn+1

3
CPU 1 5 Interrupt controller 6

1: Interrupt

Disk controller 4

Operating system Interrupt handler 2: Process interrupt

3: Return

Left: sequence as seen by hardware Request sent to controller, then to disk

Disk responds, signals disk controller which tells interrupt

controller Interrupt controller notifies CPU Right: interrupt handling (software point of view)
27

How a Modern Computer Works


-CPU: unit where instructions are Executed -Memory: storage where both program and data are stored - I/O subsystem: unit to input and output data - Instruction Execution Cycle do forever 1. fetch next instruction 2. execute the instruction 3. check and process interrupt

Operating System Concepts 8th Edition , Silberschatz, Galvin,

28

Direct Memory Access Structure


Used

for high-speed I/O devices able to transmit information at close to memory speeds (network card or disk drive 1G/sec) . Device controller transfers blocks of data from buffer storage directly to main memory without CPU intervention per block, rather than the -Only CPUone interrupt is generated - Device controller one interrupt per byte -Sets up (large) buffers -When device I/O in memory complete, transfer data - Asks device controller directly into memory to transfer into buffer -Send interrupt when Receives single transfer complete interrupt for whole buffer -Avoids CPU data intervention Operatingof System Concepts 8 Edition , Silberschatz, Galvin,
th

29

Direct Memory Access (DMA) operation

Operating System Concepts 8th Edition , Silberschatz, Galvin,

30

Synchronous vs Asynchronous I/O


Synchronous: After I/O starts, control returns to user program only upon I/O completion Asynchronous: After I/O starts, control returns to user program without waiting for I/O completion

Synchronous I/O
Operating System Concepts 8th Edition , Silberschatz, Galvin,

Asynchronous I/O

Storage Structure
Main memory only large storage media that the

CPU can access directly. It stores data and programs in execution (running) until power is disconnected (Volatile storage) Secondary storage extension of main memory that provides large nonvolatile storage capacity. It stores programs (files) that can be executed when needed. Files remains stored until they are deleted. Magnetic disks rigid metal or glass platters covered with magnetic recording material
Disk surface is logically divided into tracks, which are
Operating System Concepts 8th Edition , Silberschatz, Galvin,

subdivided into sectors

32

Disk drive structure


Data stored on surfaces Up to two surfaces per platter One or more platters per disk Data in concentric tracks Tracks broken into sectors
256B-1KB per sector

head

sector

platter track cylinder

Cylinder: corresponding tracks

on all surfaces

Data read and written by

heads
Actuator moves heads Heads move in unison

surfaces

spindle

actuator
33

Storage Hierarchy
Storage systems organized in hierarchy Speed

Cost
Volatility Caching copying information into faster storage

system; main memory can be viewed as a last cache for secondary storage

Operating System Concepts 8th Edition , Silberschatz, Galvin,

34

Storage-Device Hierarchy

Operating System Concepts 8th Edition , Silberschatz, Galvin,

35

Operating System Concepts 8th Edition , Silberschatz, Galvin,

36

Performance of Various Levels of Storage

Goal: really large memory with very low access time.

Access times are smaller at the top of the hierarchy


Capacities are larger at the bottom of the hierarchy

Solution: move data between levels to create illusion of large

memory with low latency. Movement between levels of storage hierarchy can be explicit (by instructions) or implicit (by hardware) or vice versa.
Operating System Concepts 8th Edition , Silberschatz, Galvin,
37

Caching
Important principle, performed at many

levels in a computer (in hardware, operating system, software) 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


Cache smaller than storage being cached
Operating System Concepts 8th Edition , Silberschatz, Galvin,
38

Computer-System Architecture
Categorizing according to number of general

purpose processors: 1. Single-Processor Systems (PDAs through mainframes) have


a single general-purpose processor Has a general purpose Instruction set. Runs user programs (processes). Some special-purpose processors as well (for DISK, ..)

to relieve the CPU from some I/O tasks such as disk scheduling

sometimes controlled by the OS in mainframes, they may be general I/O processors


39

Operating System Concepts 8th Edition , Silberschatz, Galvin,

Computer-System Architecture (cont.)


2. Multiprocessors systems growing in use and

importance
(Also known as parallel systems, tightly-coupled systems)

Have two or more processors In close communication Sharing computer bus Sometimes share clock ,memory and peripheral devices. Advantages include 1. Increased throughput : process/unit time
1.

not linearly because of used time in managing them.

2. Economy of scale
1. Cost is less than the equivalent multiple single-processor systems.

3. Increased reliability
1. If one processor fails the remaining can carry its job

Graceful degradation or fault tolerance

(multi-processes, multiprocessor Operating System Concepts 8th Edition , Silberschatz, Galvin, environment)

Problems

and

distributed

40

Fault tolerance and Graceful degradation


Fault-tolerant systems are designed so that if a component fails or a

network route becomes unusable, a backup component, procedure or route can immediately take its place with no negative impact whatsoever on individual subscribers (implemented by hardware and software duplication). Graceful degradation is the ability of a computer, machine, electronic system or network to maintain limited functionality even when a large portion of it has been destroyed or rendered inoperative. The purpose of graceful degradation is to prevent catastrophic failure. Multiprocessing model can cause a system to change its memory access model from uniform memory access (UMA) to non-uniform memory access (NUMA). UMA is the situation in which access to any RAM from any CPU takes the same amount of time.
Operating System Concepts 8th Edition , Silberschatz, Galvin,
41

Multiprocessors systems have two types


1.

Symmetric Multiprocessing( SMP) : all processors are peers.


The processors are symmetric, that is, they can do anything the others can. Each can look at or alter any element of memory, and each can do any kind of I/O. It is symmetrical because the view from any processor of the rest of the system is exactly the same. All processors share physical memory. Example is Solaris (version 5 of UNIX by SUN) Virtually all modern OS provide support for SMP (Windows, Mac, and Linux).

Operating System Concepts 8th Edition , Silberschatz, Galvin,

42

Multiprocessors systems have two types


2.

Asymmetric Multiprocessing: Master-Slave


In asymmetric multiprocessing, the program tasks (or threads) are strictly divided by type between processors and typically, each processor has its own memory address space. A master processor controls the system, other processors are slaves. The master processor schedules and allocates work to the slave processors. Example is SunOS version 4.

Note :The difference between SMP and ASMP may result from either hardware or software (OS).

Operating System Concepts 8th Edition , Silberschatz, Galvin,

43

Symmetric Multiprocessing Architecture with each processor having its own cash

SMP is easier to implement in operating systems and is the method used most often in operating systems that support multiple processors. Operating systems that support SMP include: OS/2 Warp Server 4.0 ,OS/2 for SMP 2.11,Windows NT 4.0, Novell NetWare 4.1 SMP ,Novell UnixWare SMP 2.0 SCO Open Server 5.0 with SCO MPX 3.0, Banyan Vines
Operating System Concepts 8th Edition , Silberschatz, Galvin,
44

Multicore Design for Multiprocessing systems


Multiple computing cores on a single chip More efficient than multiple chips with single core because on- chip communication is faster and uses less power. specially suitable for server systems Appear to the OS as N standard processors.

A Dual-Core Design example


Operating System Concepts 8th Edition , Silberschatz, Galvin,
45

Clustered Systems
Like multiprocessor systems, but multiple systems working together Usually sharing storage via a storage-area network (SAN). Closely linked via a local-area network. (LAN).

Provides a high-availability service which survives failures

(known as High-availability clusters or failover clusters) Asymmetric clustering has one machine in hot-standby mode (redundant node used to provide service when the other fails) Symmetric clustering has multiple nodes running applications, monitoring each other, each working in a different application. Also, if a node fails ,the other carry its job providing availability and scalability. Some clusters are for high-performance computing (HPC): Single application on multiple nodes. Applications must be written to use parallelization Example is Beowulf clusters: use personal computers connected via simple LAN to solve HPC problems using open source software. 46 th Edition , Silberschatz, Galvin, Operating System Concepts 8 The vast majority of the TOP500 supercomputers are clusters.[28]

General structure of a clustered System

computer

interconnect

computer

interconnect

computer

Storage Area Network (SAN)

Operating System Concepts 8th Edition , Silberschatz, Galvin,

47

Beowulf Cluster
A cluster implemented on multiple identical commercial off-the-shelf computers connected with a TCP/IP Ethernet local area network.[27] Beowulf technology was originally developed by Thomas Sterling and Donald Becker

Operating System Concepts 8th Edition , Silberschatz, Galvin,

48

OS History: Evolution of Systems


Batch Systems Goal: Maximize amount of work done for multiple users Applications run one after the other. One application at a time! Application uses all computer resources Batch Multiprogramming Multiple applications in memory When one waits for I/O, another executes Better utilization of CPU Timesharing Systems Interactive use of computers Responsiveness matters Expect system to respond to keyboard input immediately Several users/applications can share computer Share CPU, Disk, Memory...
Operating System Concepts 8th Edition , Silberschatz, Galvin,

Real Time : Controlling machine , timing is critical.

49

Operating System Structure


Multiprogramming needed for efficiency (why) Single user cannot keep CPU and I/O devices busy at all times Multiprogramming organizes jobs (code and data) so CPU always has one to execute A subset of total jobs in system is kept in memory One job selected and run via job scheduling (ch5) When it has to wait (for I/O for example), OS switches to another job Use interrupts to run multiple programs

simultaneously (how)
When a program performs I/O, instead of polling, execute

another program till interrupt is received.

Operating System Concepts 8th Edition , Silberschatz, Galvin,

50

Operating System Structure (contd)


Timesharing (multitasking) is logical extension in which

CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing Programs queued for execution in FIFO order. Like multiprogramming, but timer device interrupts after a quantum (timeslice).

Interrupted program is returned to end of FIFO Next program is taken from head of FIFO Response time should be < 1 second Each user has at least one program executing in memory process If several jobs ready to run at the same time CPU scheduling (ch5) If processes dont fit in memory, swapping moves them in and out to run Virtual memory (ch9) allows execution of processes not completely in memory
Operating System Concepts 8th Edition , Silberschatz, Galvin,

51

Job Scheduling in Multiprogramming


How OS switches between jobs OS keeps multiple jobs in memory. Jobs are loaded at a specific address in memory OS gives each job multiple slots of CPU time until they finish their task. choose one of them to get CPU for a period of time. How? FIFO, Priority If that job finishes its task during the allotted time, this job is halted If that job does not finish its task and need more CPU time, it will be preempted (ready) and another job will be selected and given the CPU. The suspended job will later get another slot of CPU time If that job does I/O operation, this job will be waiting and CPU will be taken from that job and given to another selected job. The waiting job on I/O operation will resume operation later and get CPU only when the I/O is complete and the device interrupts OS Operating System Concepts 8th Edition , Silberschatz, Galvin,

52

Operating-System Operations
OS is Interrupt driven by hardware interrupts (I/O or timer) software interrupts caused by
request for operating system service (SW interrupt or trap) SW error (exception or trap)

Division by zero, Invalid memory access

When an interrupt or a trap occurs, it signals code

segment of OS to execute to complete the required task corresponding to a specific event.


Since many processes are running and sharing

all resources, some problems may occur


A process stuck in infinite loop, affect other processes

(solution use timer). processes modifying each other or the operating system area (solution use dual mode).
Operating System Concepts 8th Edition , Silberschatz, Galvin,

53

Job Scheduling for Multiprogrammed System- Timer


We must ensure that OS has control over CPU to schedule

process. To accomplish this, OS uses Timer to prevent infinite loop / process hogging resources
Timer is Set to interrupt the system after specific period (its counter is initialized by the number of seconds for example) When time is up (counter = 0), Interrupt occurs and control goes to OS which can decide to treat it as error or it can set it again to give the process more time to run
Example a process needs 7 min (420 sec), every sec generate an interrupt

and decrement the counter by 1. Only when counter = 0, OS stops it.


Set up before scheduling process to regain control or terminate

program that exceeds allotted time. Thus preventing a process to run th Operating System Concepts 8 Edition , Silberschatz, Galvin, long period than it is needed.

54

Dual Mode
Dual-mode operation allows OS to protect itself and

other system components


User mode and kernel (system, supervisor, privileged) mode Mode bit provided by hardware
Provides ability to distinguish when system is running user code or

kernel code Some instructions designated as privileged, only executable in kernel mode (I/O control and Interrupt and timer management) System call changes mode to kernel, return from call resets it to user If a user tries to execute a privileged instruction or access memory outside its space, the hardware traps to the OS..

Transition from User to Kernel Mode


Operating System Concepts 8th Edition , Silberschatz, Galvin,

55

Transition from User to Kernel Mode


When a user program requests a service (1) via Sys. Call. ( to create,

delete, and use (access) objects (process, files, memory, etc) 1. a special instruction switches the machine from user mode to kernel mode (OS mode) where the OS is running. Set mode = 0 2. Kernel examines the parameters of the sys. Call to determine which service is called (2). E.g read( fd, buf, 100) 3. Kernel then executes the corresponding service procedure indexed in the dispatch table (3). Each sys call has service procedure to execute 4. Finally, the sys. Call is finished and control is given back to the user program. Set mode = 1

UserProgram 1 1 2 4
Service Procdure

User Mode
Kernel Mode

Operating System Concepts 8th Edition , Silberschatz, Galvin,

Dispatch Table

56

Core Tasks of an OS
Processor management Memory management Device management Storage management

Application interface
User interface

Operating System Concepts 8th Edition , Silberschatz, Galvin,

Process Management (ch3)


program vs. process A program is a passive entity. A process is an active entity. A process is an abstraction of a running program. A process is a program in execution. It is a unit of work within the system Process needs resources to accomplish its task CPU, memory, I/O, files Initialization data Process termination requires reclaim of any reusable

resources 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

(ch4) Operating System Concepts 8 Edition , Silberschatz, Galvin, Typically, a system has many processes, some user, some
th

58

Process Management Activities


The operating system is responsible for the following activities in connection with process management:
Scheduling processes and threads on the CPUs

(ch5) Creating and deleting processes (ch3) Suspending and resuming processes (ch3) Providing mechanisms for process synchronization (ch6) Providing mechanisms for process communication (ch3) Providing mechanisms for deadlock handling (ch7)
Operating System Concepts 8th Edition , Silberschatz, Galvin,
59

Memory Management (ch8 & ch9)


All data in memory before and after processing

All instructions in memory in order to execute


Memory management is needed in multiprogramming and

time sharing systems because many programs will reside in the same time in memory, to Optimize CPU utilization and computer response to users. Memory management activities Keeping track of which parts of memory are currently being used and by whom. How much free Deciding which processes and data to move into and out of memory (swapping/paging) Allocating and deallocating memory space as needed
Operating System Concepts 8th Edition , Silberschatz, Galvin,
60

Storage Management (ch10 & ch11)


OS provides uniform, logical view of information storage Abstracts physical properties to logical storage unit - file
Each medium is controlled by device drive ( e.g. tape drive) Varying properties include access speed, capacity, data-

transfer rate, access method (sequential or random) File-System management Files usually organized into directories Access control on most systems to determine who can access what (Read-Write-Excecute) OS activities include 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

Operating System Concepts 8th Edition , Silberschatz, Galvin,

61

Mass-Storage Management (ch10 & ch11)


Usually disks used to store data that does not fit in main memory or

data that must be kept for a long period of time Proper management is of central importance Entire speed of computer operation hinges on disk subsystem and its algorithms OS activities Free-space management (used/free space) Storage allocation/deallocation Disk scheduling Some storage need not be fast ( for backup and long term archiving) Tertiary storage includes optical storage, magnetic tape Still must be managed Varies between WORM (write-once, read-many-times) and RW Operating System Concepts 8th Edition , Silberschatz, Galvin, (read-write)

62

Migration of Integer A from Disk to Register


Multitasking environments must be careful to use most recent value, no

matter where it is stored in the storage hierarchy

Multiprocessor environment must provide cache coherency in hardware

such that all CPUs have the most recent value in their cache Distributed environment situation even more complex Several copies of a datum can exist Various solutions covered in Chapter 17

Operating System Concepts 8th Edition , Silberschatz, Galvin,

63

I/O Subsystem
One purpose of OS is to hide peculiarities 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 outputs of other jobs) General device-driver interface Drivers for specific hardware devices

Operating System Concepts 8th Edition , Silberschatz, Galvin,

64

Protection and Security


Protection any mechanism for controlling access of processes

or users to resources defined by the OS Security defense of the system against internal and external attacks Huge range, including denial-of-service, worms, viruses, identity theft, theft of service Systems generally first distinguish among users, to determine who can do what User identities (user IDs, security IDs) include name and associated number, one per user User ID then associated with all files, processes of that user to determine access control Group identifier (group ID) allows set of users to be defined, then also associated with each process, file. Privilege escalation allows user to change to effective ID with more rights
65

Operating System Concepts 8th Edition , Silberschatz, Galvin,

Computing Environments
Traditional computer Blurring over time, As computer matures.

Office environment
PCs connected to a network, terminals attached

to mainframe or minicomputers providing batch and timesharing Now portals allowing networked and remote systems access to same resources Home networks Used to be single system, then modems Now firewalled, networked
Operating System Concepts 8th Edition , Silberschatz, Galvin,
66

Computing Environments (Cont)


Client-Server Computing

Terminals connected to mainframes are supplanted by smart PCs Many systems now are servers, responding to requests generated by clients, two types:

Compute-server provides an interface to client to request


services (i.e. database)

File-server provides interface for clients to store and retrieve


files

Operating System Concepts 8th Edition , Silberschatz, Galvin,

67

Peer-to-Peer Computing
Another model of distributed system P2P does not distinguish clients and servers Instead all nodes are considered peers Each may act as client, server or both Node must join P2P network
Registers its service with central lookup service on network, or Broadcast request for service and respond to requests for

service via discovery protocol

Examples include Napster and Gnutella

Why is this better than traditional client-server? Server no longer a bottleneck


Operating System Concepts 8th Edition , Silberschatz, Galvin,
68

Web-Based Computing
Web has become ubiquitous PCs most prevalent devices

More devices becoming networked to allow web

access New category of devices to manage web traffic among similar servers: load balancers Use of operating systems like Windows 95, clientside, have evolved into Linux and Windows XP, which can be clients and servers

Operating System Concepts 8th Edition , Silberschatz, Galvin,

69

Open-source Operating systems


Open source: Free and made available to everyone Access to source code Closed source: Access to binary files only Advantages of open-source operating systems Better quality code Counter to the copy protection and Digital Rights

Management (DRM) movement Started by Free Software Foundation (FSF), which has copyleft GNU Public License (GPL) Examples include GNU/Linux, BSD UNIX (including core of Mac OS X), and Sun Solaris
Operating System Concepts 8th Edition , Silberschatz, Galvin,

Open Source vs Closed Source

Operating System Concepts 8th Edition , Silberschatz, Galvin,

71

Você também pode gostar