+ All Categories
Home > Documents > Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to...

Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to...

Date post: 11-Jan-2016
Category:
Upload: cecily-banks
View: 227 times
Download: 6 times
Share this document with a friend
Popular Tags:
110
Unit 3. Operating System Unit 3. Operating System Software Software An An operating system operating system performs a vital role performs a vital role in in Enabling users to interact with a computer Enabling users to interact with a computer system. system. Taking the specific responsibilities Taking the specific responsibilities device management, device management, memory management, memory management, resource sharing, and resource sharing, and process control. process control. After learning, you will understand After learning, you will understand some of the some of the problems problems that can cause your computer that can cause your computer to perform less than optimally and to perform less than optimally and some of the some of the solutions solutions that can resolve those that can resolve those problems. problems. learn how to customize your computing environment learn how to customize your computing environment to your to your personal taste personal taste . .
Transcript
Page 1: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Unit 3. Operating System Unit 3. Operating System SoftwareSoftware

An An operating systemoperating system performs a vital roleperforms a vital role in in– Enabling users to interact with a computer system. Enabling users to interact with a computer system. – Taking the specific responsibilitiesTaking the specific responsibilities

device management, device management, memory management, memory management, resource sharing, and resource sharing, and process control. process control.

After learning, you will understand After learning, you will understand – some of the some of the problemsproblems that can cause your computer to that can cause your computer to

perform less than optimally and perform less than optimally and – some of the some of the solutionssolutions that can resolve those problems. that can resolve those problems. – learn how to customize your computing environment to learn how to customize your computing environment to

your your personal tastepersonal taste..

Page 2: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

contentscontents

3.1 Structure3.1 Structure

3.2 Device Management and Configuration3.2 Device Management and Configuration

3.3 Resource sharing3.3 Resource sharing

3.4 File Systems3.4 File Systems

Page 3: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.1 Structure3.1 Structure

3.1.1 Layers of Software3.1.1 Layers of Software

3.1.2 The BIOS: Life at the Bottom.3.1.2 The BIOS: Life at the Bottom.

3.1.3 Process Control.3.1.3 Process Control.

3.1.4 Lab: Task Manager. 3.1.4 Lab: Task Manager.

Page 4: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

software has its own structuresoftware has its own structureJust as we previously discussed with respect to hardware, a Just as we previously discussed with respect to hardware, a computer system's software has its own structurecomputer system's software has its own structure. . The operating system is not a single entity but is composed The operating system is not a single entity but is composed of of multiple layers(multiple layers( 多层多层 )), , each with its own area of each with its own area of responsibilityresponsibility. . The operating system's layers and the applications the user The operating system's layers and the applications the user runs are considered runs are considered uniqueunique "tasks" or "processes," "tasks" or "processes," – competingcompeting for access to the CPU and other hardware for access to the CPU and other hardware

resourcesresources. . 争夺资源争夺资源The management of this competitionThe management of this competition through through – the proper scheduling of processes is a major the proper scheduling of processes is a major

responsibility of an operating system andresponsibility of an operating system and– can have a significant can have a significant impact on system performanceimpact on system performance..

Page 5: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.1.1 Layers of Software3.1.1 Layers of Software

Layers and Process Management Layers and Process Management

Encapsulation and Abstraction Encapsulation and Abstraction

Layers of Software Layers of Software

Page 6: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Software systems are composed of Software systems are composed of multiple layersmultiple layers

the same can be found many features of everyday the same can be found many features of everyday life life

Example. Example.

第一层第一层 学生学生 用餐用餐

第二层第二层 食堂食堂 制作、供应饭菜、采购, 收款制作、供应饭菜、采购, 收款 / / 采购采购

第三层第三层 市场商贩市场商贩 卖菜、进货卖菜、进货

第四层第四层 加工厂加工厂 加工粮食蔬菜加工粮食蔬菜

第五层第五层 农民农民 种粮种菜种粮种菜

Page 7: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Encapsulation and AbstractionEncapsulation and Abstraction

EncapsulationEncapsulation (封装)(封装) means that each means that each layer needs only a limited amount of layer needs only a limited amount of knowledge to do its job knowledge to do its job – Organizing software into layers that are relatively Organizing software into layers that are relatively

independent independent 各司其职各司其职keep the entire system manageable, and keep the entire system manageable, and

afford greater efficienciesafford greater efficiencies

AbstractionAbstraction (抽象)(抽象) means how the means how the software layers communicate, beyond the software layers communicate, beyond the view of the userview of the user

Page 8: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of SoftwareLayers of Software

User-Written ScriptsUser-Written Scripts

User InterfaceUser Interface

ApplicationApplication

Run-time LibraryRun-time Library

Application Program InterfaceApplication Program Interface

Operating SystemOperating System

KernelKernel

Device DriversDevice Drivers

BIOSBIOS

HardwareHardware

Top

Bottom

Page 9: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software (continued)Layers of Software (continued)HardwareHardware::– Lowest level of the computerLowest level of the computer– The physical componentsThe physical components (物理器件) (物理器件) from from

which the computer system is constructedwhich the computer system is constructedBIOS (Basic Input/Output System)BIOS (Basic Input/Output System)::– Most primitive levelMost primitive level of software of software 最低级别最低级别的软件的软件– Deals directly with the signals that control each Deals directly with the signals that control each

hardware componenthardware component– Most of its work is done when the system first Most of its work is done when the system first

boots upboots up

Page 10: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software (continued)Layers of Software (continued)Device driversDevice drivers::– Helper programs used by Operating systems to Helper programs used by Operating systems to

control a devicecontrol a device– when add new hardware, when add new hardware,

the appropriate device driver must be present.the appropriate device driver must be present.Provided by the device manufacturerProvided by the device manufacturer in floppies or in floppies or other storage mediaother storage media

– Instructions are to be followed to install the device Instructions are to be followed to install the device and its drivers.and its drivers.

– Windows OS may sometimes have such drivers Windows OS may sometimes have such drivers stored.stored.

Page 11: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software (continued)Layers of Software (continued)

kernelkernel::– Performs functions that arePerforms functions that are critical critical to maintaining to maintaining

the operating systemthe operating system– The kernel is responsible for The kernel is responsible for

Memory managementMemory managementProcess and task managementProcess and task managementDisk management. (File System)Disk management. (File System)Interrupt Handling (Interrupt Handling ( 中断处理中断处理 ))

– Resident in RAM Resident in RAM at all times at all times 驻留 驻留 (回顾 内部命 (回顾 内部命令)令)

– Because space is a factor, the Because space is a factor, the kernel is kept smallkernel is kept small

Page 12: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software: Operating Layers of Software: Operating SystemSystem

Operating System (OS)Operating System (OS)::– Implements all other functions the OS is to performImplements all other functions the OS is to perform

File system managementFile system managementCommunicates with the kernel when basic actionsCommunicates with the kernel when basic actions

– e.g., e.g., data transfer operation to a peripheraldata transfer operation to a peripheral

– Master controller of Master controller of all the activities of the computerall the activities of the computer– Sets standards for all the application software used in a Sets standards for all the application software used in a

computer systemcomputer system

– Different operating systems have Different operating systems have

different different user interfacesuser interfaces and and

run run compatiblecompatible (兼容)(兼容) applicationsapplications

Examples: Examples: Microsoft Windows, UNIX, LINUX, Mac OSMicrosoft Windows, UNIX, LINUX, Mac OS

Page 13: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software: Operating System Layers of Software: Operating System (continued)(continued)

External Services of OS: External Services of OS:

– Help users start programsHelp users start programs

– Manage stored dataManage stored data

– Maintain Maintain security of the systemsecurity of the system (口令,限制访(口令,限制访问)问)

– Provides ways to Provides ways to

select an application program, select an application program,

find, rename and delete documents and other data find, rename and delete documents and other data

stored on diskstored on disk

Page 14: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software: Operating System Layers of Software: Operating System (continued)(continued)

Internal services of OS:Internal services of OS:

– controls input and outputcontrols input and output

– Allocates system resources (Allocates system resources (e.g. memory, disk e.g. memory, disk

drive capacity, processor timedrive capacity, processor time))

– Manages storage for programs and dataManages storage for programs and data

– Detects Detects equipment failures(equipment failures( 设备故障设备故障 ))

Page 15: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software: Operating System Layers of Software: Operating System (continued)(continued)

Operating systems can be classified into two Operating systems can be classified into two categories.categories.– A A server(server( 服务器服务器 )) operating systemoperating system is designed is designed

for computers that provide for computers that provide centralized storage facilities(centralized storage facilities( 集中式存储设备集中式存储设备 )) and and

communications capabilities for networks and Web communications capabilities for networks and Web sites.sites.

– A A desktop operating systemdesktop operating system is designed for a is designed for a single-user microcomputer(single-user microcomputer( 微机微机 ).).

Page 16: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software (continued)Layers of Software (continued)Application Program Interface (API)Application Program Interface (API)::– A set of routines, protocols, and tools A set of routines, protocols, and tools for building software for building software

applicationsapplications– Abstraction defined by OS to manage memory for Abstraction defined by OS to manage memory for

applicationsapplications– Application communicates with OS through the API.Application communicates with OS through the API.

Run time Libraries(Run time Libraries( 运行时程序库运行时程序库 )): : – A library of routines that are A library of routines that are bound(bound( 绑定绑定 )) to the program to the program

during executionduring execution– Collection of Software routines which application programs Collection of Software routines which application programs

rely onrely on– Functions that make Functions that make appropriate APIappropriate API calls needed to calls needed to

enable the OS to performenable the OS to perform accordingly accordingly

Page 17: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software (continued)Layers of Software (continued)Application (Application ( 应用程序应用程序 ))::– Layer where the routines perform tasks the application is Layer where the routines perform tasks the application is

designed to do.designed to do.

User interface (User interface ( 用户接口,用户界面用户接口,用户界面 ))::– Responsible for the communication between the Responsible for the communication between the

application and the userapplication and the user

– Typically it is a Typically it is a GUIGUI, composed of , composed of buttonsbuttons and and pull-down pull-down menusmenus

– The GUI passes the information on to the applicationThe GUI passes the information on to the application

Page 18: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software (continued)Layers of Software (continued)

ScriptsScripts (脚本)(脚本) or or macrosmacros(宏)(宏) ::– Routines that many applications use to allow users to Routines that many applications use to allow users to

create documents using the application’s create documents using the application’s built-in built-in commandscommands..

– Allow users to automate sequences of actions they Allow users to automate sequences of actions they perform frequentlyperform frequently

– Can perform any function that does Can perform any function that does not require additional not require additional user inputuser input

网页脚本网页脚本VBA VBA 宏宏

Page 19: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Layers of Software (continued)Layers of Software (continued)

The computer industry The computer industry relies on specialistsrelies on specialists in in each layer of software. each layer of software. – Some people make their living writing BIOS Some people make their living writing BIOS

software. software. – Others concentrate on improving GUI technology.Others concentrate on improving GUI technology.– The greatest number of programmers are found The greatest number of programmers are found

at the application level.at the application level.

Page 20: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Windows OSWindows OSWindows 95/98/NT/ME/2000/XP/VistaWindows 95/98/NT/ME/2000/XP/Vista

– Widely used in PCsWidely used in PCs

– Supports vast applications and peripheral devicesSupports vast applications and peripheral devices

– Provides icons, buttons, menus and various other Provides icons, buttons, menus and various other graphical objects that can be manipulated by a mousegraphical objects that can be manipulated by a mouse

– Provides a command-line interfaceProvides a command-line interface

– Supports Supports multitaskingmultitasking

– Designed to run Designed to run high-end and complicated taskshigh-end and complicated tasks such as such as video editing, scientific visualizationvideo editing, scientific visualization, and , and CAD (computer CAD (computer aidedaided design)design)

Provide reliability, security, and support for software Provide reliability, security, and support for software applicationsapplications

Page 21: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Mac OSMac OSIntroduced By APPLE computersIntroduced By APPLE computersContains graphical user interface featuring menus Contains graphical user interface featuring menus and iconsand iconsOS interface through keyboard or mouseOS interface through keyboard or mouseSoftware applications that are compatible with Mac Software applications that are compatible with Mac OS are called OS are called Mac softwareMac software..Fewer softwareFewer software are compatible with Mac OS than are compatible with Mac OS than Windows OS.Windows OS.Mac OS has good graphical application software Mac OS has good graphical application software support.support.Some Some hardware and software add-ons(hardware and software add-ons( 附加硬件软附加硬件软件件 )) enable Windows software to run on Mac OS. enable Windows software to run on Mac OS.

Page 22: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Mac OS (continued)Mac OS (continued)

In 1984, Apple Computer introduced the In 1984, Apple Computer introduced the revolutionary revolutionary Lisa computerLisa computer..

The Macintosh computer, with its The Macintosh computer, with its graphical graphical user interfaceuser interface, , Mac OSMac OS, was a major factor , was a major factor contributing to its success.contributing to its success.

The iMaccomputer

Page 23: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

DOSDOS

DOSDOS stands for stands for ddisk isk ooperating perating ssystem.ystem.– Developed by Microsoft and introduced in IBM-PC.Developed by Microsoft and introduced in IBM-PC.– Uses command-line interface.Uses command-line interface.– Has been incorporated into Windows OSHas been incorporated into Windows OS– Operates behind the scenes so Windows users do not Operates behind the scenes so Windows users do not

have to memorize and type complex commandshave to memorize and type complex commands

Page 24: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Windows Server, NetWare, UNIX and Windows Server, NetWare, UNIX and LINUXLINUX

Computer providing Computer providing centralized storagecentralized storage and and communications servicescommunications services requires requires Server OSServer OS– similar tosimilar to Desktop OS : User interface and appearance Desktop OS : User interface and appearance– DiffersDiffers : managing : managing largelarge flow of data on flow of data on largelarge networks networks

and web sitesand web sites

Novell NetWareNovell NetWare: developed for micro computer : developed for micro computer networknetwork– Used to access documents and data files in a Used to access documents and data files in a

centralized storagecentralized storage– Handled by network managers rather than by Handled by network managers rather than by

average computer usersaverage computer users

Page 25: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Windows Server, NetWare, UNIX and Windows Server, NetWare, UNIX and LINUX (continued)LINUX (continued)

UNIX and LINUXUNIX and LINUX::– Developed for mini and micro computer networks Developed for mini and micro computer networks

and web servers of all sizes.and web servers of all sizes.– Variation of UNIX is LINUX, which is has a Variation of UNIX is LINUX, which is has a stablestable

and and securesecure OS. OS.– UNIX and LINUX are suitable for servers and UNIX and LINUX are suitable for servers and

high-end workstations.high-end workstations.– A GUI environment is provided in UNIX and A GUI environment is provided in UNIX and

LINUX for ease of operation.LINUX for ease of operation.

Page 26: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Handheld Operating SystemsHandheld Operating Systems

Page 27: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

UtilitiesUtilities

Subcategory of Subcategory of system softwaresystem software to to augmentaugment(( 增强功能增强功能 )) OS OS– Allow users to control the hardware resources Allow users to control the hardware resources

and allocationand allocation

Some Utilities comes with OS such asSome Utilities comes with OS such as– Providing information about files on the diskProviding information about files on the disk– Preparing disk to hold dataPreparing disk to hold data– Copy files from one disk to anotherCopy files from one disk to another

Page 28: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Utilities (continued)Utilities (continued)

Utility Software Utility Software protectsprotects computer from computer from virusesviruses that that erase or damage your data.erase or damage your data.

Norton UtilitiesNorton Utilities::

– Retrieves data from damaged disk, encrypt it and Retrieves data from damaged disk, encrypt it and helps troubleshoot the problemhelps troubleshoot the problem

OS provides disk formatting utility to format disks.OS provides disk formatting utility to format disks.– Formatting diskFormatting disk::

Creating electronic storage shelves for dataCreating electronic storage shelves for dataIt is safe to format even a pre-formatted disk or a disk formatted It is safe to format even a pre-formatted disk or a disk formatted for another OS.for another OS.

Page 29: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.1.2 The BIOS: Life at the 3.1.2 The BIOS: Life at the BottomBottom

The Role of the BIOS The Role of the BIOS

Changing BIOS Settings Changing BIOS Settings

Page 30: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

The Roles of the BIOSThe Roles of the BIOSThe BIOS performs 3 major functionsThe BIOS performs 3 major functions– initializes hardware when the computer is first turned oninitializes hardware when the computer is first turned on

– loads the O/Sloads the O/S

– provides basic support for devices such as the provides basic support for devices such as the keyboard, keyboard, mouse, and serial portsmouse, and serial ports

The The BIOSBIOS resides on a ROM chip resides on a ROM chip– Non-volatileNon-volatile– Slower than DRAMSlower than DRAM

Loads itself into DRAMLoads itself into DRAM

Uses CMOSUses CMOS– CMOS is CMOS is powered by batterypowered by battery, therefore, , therefore, it is volatileit is volatile

– Contains BIOS Contains BIOS parameter settingsparameter settings for hardwarefor hardware and memory and memory speed speed

Page 31: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

BIOS (continued)BIOS (continued)The The BIOSBIOS initiates the initiates the POSTPOST (Power-On Self Test)(Power-On Self Test) sequence sequence

– Enables the video cardEnables the video card

– Counts and tests memoryCounts and tests memory

– Checks for expansion cards and adapters(Checks for expansion cards and adapters( 适配器适配器 )) and and initializes theminitializes them

– Follows a search order to find the Follows a search order to find the MBR MBR ((Master Boot Master Boot

RecordRecord,主引导记录,主引导记录 ))

A program is invoked to load the operating system A program is invoked to load the operating system once the once the MBRMBR is found is found

Page 32: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Bootable FloppyBootable Floppy

Boot disk (Boot disk ( 启动盘启动盘 )) is a floppy is a floppy containing bootable containing bootable copy of OScopy of OS..

Used in the case of hard drive corruptionUsed in the case of hard drive corruption when the when the system crashes.system crashes.

Computer that can be booted by a floppy Computer that can be booted by a floppy is not fully is not fully secure.secure.– Anyone can boot their version of OS, which ignores the file Anyone can boot their version of OS, which ignores the file

protections and can access any file on the system.protections and can access any file on the system.– MBR (Master Boot Record) virusesMBR (Master Boot Record) viruses affect the Boot disk. affect the Boot disk.

Page 33: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

The Boot ProcessThe Boot Process

Page 34: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Changing BIOS SettingsChanging BIOS SettingsTo change BIOS settings, you must To change BIOS settings, you must enter the BIOS setup enter the BIOS setup program during the boot sequenceprogram during the boot sequence, by pressing a specified , by pressing a specified key or key combination. key or key combination. The initial message the BIOS displays will tell you what keys The initial message the BIOS displays will tell you what keys to press. , such as to press. , such as F2F2 or or ALT+CTRL+ESCALT+CTRL+ESCThe setup programThe setup program– shows the current BIOS settings and shows the current BIOS settings and – allows to change them. allows to change them.

It stores the new settings in It stores the new settings in CMOS memoryCMOS memory so they will be so they will be available the next time the machine is turned on. available the next time the machine is turned on. taketake Care Care !! when modifying BIOS settings, when modifying BIOS settings, – because because the wrong settings can make the computer unusablethe wrong settings can make the computer unusable..– CIH CIH 病毒病毒

Page 35: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Where does a computer store its Where does a computer store its basic hardware settings?basic hardware settings?

Page 36: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.1.3 Process Control3.1.3 Process Control

xqw
w101st
Page 37: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Process ControlProcess Control

Keeps track of all the Keeps track of all the processes(processes( 进程进程 )) runningrunning

Process is an instance of a Process is an instance of a running programrunning program

Process can be in 3 states:Process can be in 3 states:– Running Running 运行运行– Runnable Runnable 就绪就绪– Blocked Blocked 阻塞阻塞Kernel maintains a Kernel maintains a queue of processesqueue of processes ( (also also called the called the run queuerun queue, or , or waiting list of waiting list of runnable processesrunnable processes))

Page 38: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.
Page 39: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Preemptive MultitaskingPreemptive MultitaskingPreemptive multitasking(Preemptive multitasking( 抢占式多任务处理抢占式多任务处理 )) is is used to create an used to create an illusionillusion that all the processes that all the processes are running at once.are running at once.Uses a real-time clock that can generate Uses a real-time clock that can generate interrupts at regular rate. interrupts at regular rate. 定时产生中断定时产生中断– At each interrupt, another process may be run.At each interrupt, another process may be run. 当前当前

正在运行的任务的控制权被抢占,故名正在运行的任务的控制权被抢占,故名– Kernel checks whether a process should be given a Kernel checks whether a process should be given a

chance to run.chance to run.

Kernel requires a Kernel requires a context swap(context swap( 运行环境交换运行环境交换 )) for for switching processes(switching processes( 待交换的进程待交换的进程 ).).Context switching places Context switching places some over headsome over head (( 经经常性的额外消耗常性的额外消耗 )) on the processor. on the processor.

Page 40: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Context SwitchingContext Switching

Current running processCurrent running process is is demoted(demoted( 降级降级 )) from running to runnablefrom running to runnable..The steps of context swap (The steps of context swap ( 运行环境交换运行环境交换 ) :) :– Processor flushes(Processor flushes( 清空清空 )) the pipeline of the pipeline of

executing instructions.executing instructions.– Its execution process is noted.Its execution process is noted.– Register contents(Register contents( 寄存器内容寄存器内容 ) are saved.) are saved.– Kernel loads a new Kernel loads a new page table(page table( 页面表页面表 ).). Context Swaps are done often to ensure that Context Swaps are done often to ensure that all the process are given an opportunity to runall the process are given an opportunity to run..

Page 41: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.1.4 Lab: The Task Manager3.1.4 Lab: The Task Manager

Using the Windows NT/2000 Using the Windows NT/2000 Task ManagerTask Manager

Examine processes that are running, the Examine processes that are running, the number of threads a process has, system number of threads a process has, system performance, and page faults. performance, and page faults.

Windows 9x/Me has a simpler task manager, Windows 9x/Me has a simpler task manager, but it can still show running processes.but it can still show running processes.

Page 42: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.2 Device Management and 3.2 Device Management and ConfigurationConfiguration

3.2.1 Interrupt Handling.3.2.1 Interrupt Handling.

3.2.2 Hardware Attributes3.2.2 Hardware Attributes

3.2.3 Configuration.3.2.3 Configuration.

3.2.4 Lab: Device Management 3.2.4 Lab: Device Management

Page 43: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.2.1 Interrupt Handling3.2.1 Interrupt Handling

Interrupts Interrupts

Interrupt Priority and Nested Interrupts Interrupt Priority and Nested Interrupts

Traps and Faults Traps and Faults

Page 44: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Interrupts Interrupts 中断中断A A signalsignal informing a program that an event has informing a program that an event has occurred.occurred.

Interrupt signals(Interrupt signals( 中断信号中断信号 )) can come from a can come from a variety of sources.variety of sources.– Hardware interruptsHardware interrupts– Software interruptsSoftware interrupts

To avoid losing of data, interrupts are handled To avoid losing of data, interrupts are handled in in less than a 1/1000 s.less than a 1/1000 s.

PCs support 256 types of software interrupts PCs support 256 types of software interrupts and 15 hardware interrupts. (and 15 hardware interrupts. ( 有哪些上网查查有哪些上网查查 ))

Page 45: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Interrupts (continued)Interrupts (continued)

Processor receives an Processor receives an IRQ(Interrupt ReQuest)IRQ(Interrupt ReQuest)

When the processor receives a interrupt, itWhen the processor receives a interrupt, it– Stops executing the current applicationStops executing the current application– Saves the address of the last instruction executed Saves the address of the last instruction executed – Jumps to a Jumps to a fixed memory locationfixed memory location (e.g. address of (e.g. address of

keyboard keyboard interrupt handler (interrupt handler ( 中断处理程序中断处理程序 ))))– Starts executing the instructions it finds there in the new Starts executing the instructions it finds there in the new

memory locationmemory location– Processor’s registers contain data the user program was Processor’s registers contain data the user program was

manipulating at the time. Interrupt Handler must save the manipulating at the time. Interrupt Handler must save the contents of registers before it saves the register for its own contents of registers before it saves the register for its own purposes. purposes. 保存寄存器数据保存寄存器数据

Page 46: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

keyboard keyboard interrupt handlerinterrupt handler– Examines the state of the keyboard interface Examines the state of the keyboard interface – Accepts the byte of incoming dataAccepts the byte of incoming data– Places the byte in a storage area Places the byte in a storage area

The byte is checked by the keyboard driver the next The byte is checked by the keyboard driver the next time it runs.time it runs.

– The keyboard interrupt handler restores the The keyboard interrupt handler restores the contents of the saved registers . contents of the saved registers . 恢复寄存器数据恢复寄存器数据

– Transfers control back to the previous task it was Transfers control back to the previous task it was executing. executing. 控制交还给被中断的程序控制交还给被中断的程序

Page 47: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.
Page 48: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Interrupt PriorityInterrupt Priority

The processor assigns The processor assigns priorities(priorities( 优先级优先级 )) to to different types of interrupts. different types of interrupts. – 在寝室看书时下雨了,收窗外的衣服还是受邀去看在寝室看书时下雨了,收窗外的衣服还是受邀去看

电影电影

Processor assigns priorities to different types Processor assigns priorities to different types of interrupts.of interrupts.– LowLow speedspeed devices have devices have lowlow priority. priority.– HighHigh SpeedSpeed devices have devices have highhigh priority. priority.

Page 49: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Nested Interrupts Nested Interrupts 中断嵌套中断嵌套Interrupts in Interrupts handlerInterrupts in Interrupts handler – Homework Homework look up dictionary look up dictionary answer phone answer phone

…… ……

Interrupts Interrupts cannotcannot nest infinitely. nest infinitely.

Interrupt handler Interrupt handler can only be interrupted by a can only be interrupted by a higher priority interrupthigher priority interrupt..

Page 50: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.
Page 51: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Trap (Trap ( 错误错误 )) 捕捉捕捉A A traptrap is an is an event similar to an interruptevent similar to an interrupt, , – Triggered(Triggered( 触发触发 ) by the execution of processor ) by the execution of processor

instructions instructions 指令执行错误指令执行错误– An example is a division-by-zero operationAn example is a division-by-zero operation – Interrupt being triggered by an external signal, Interrupt being triggered by an external signal,

Processor traps the errorsProcessor traps the errors– similar to an interrupt similar to an interrupt – but but without time pressurewithout time pressure..

Trap handler(Trap handler( 错误处理程序错误处理程序 )) responds to an error responds to an error – either by printing a message either by printing a message – or continuing with the program.or continuing with the program.

Page 52: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Fault Fault 故障故障Occurs when:Occurs when:– The hardware is asked to perform a task that is The hardware is asked to perform a task that is

not possible for the hardware devices not possible for the hardware devices 硬件出了状硬件出了状况况

non-existent memory locationnon-existent memory location

Memory correction circuitry detects an uncorrectable Memory correction circuitry detects an uncorrectable errorerror

Attempting to divide by zeroAttempting to divide by zero

Program contains an illegal machine instructionProgram contains an illegal machine instruction

Faults and traps are Faults and traps are handled similarlyhandled similarly

Page 53: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.2.2 Hardware Attributes3.2.2 Hardware Attributes

Installing Drivers Installing Drivers

Changing a Driver's Configuration Changing a Driver's Configuration

xqw
322-324自行阅读及上机实践
Page 54: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Installing DriversInstalling Drivers

Each device Each device must havemust have a a device driver device driver in in the OS.the OS.

Device DriverDevice Driver (( 设备驱动程序设备驱动程序 )) – manages the commandsmanages the commands– transfer of datatransfer of data– error conditions that occurerror conditions that occur

Page 55: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Installing DriversInstalling DriversOS specifies an interface that a device driver OS specifies an interface that a device driver must utilize must utilize 指定驱动程序使用的接口指定驱动程序使用的接口– This means that for This means that for any particular deviceany particular device, it must , it must

have a corresponding driver for the operating have a corresponding driver for the operating systemsystem where it is intended to be used in order to where it is intended to be used in order to be functional. be functional. 所有设备必须具备驱动程序所有设备必须具备驱动程序

– DifferentDifferent versionsversions of the same OS may use an of the same OS may use an interface interface requiring different driversrequiring different drivers..

A similar but different product from the same A similar but different product from the same company will most likely require its own driver company will most likely require its own driver ??whywhy– because of some minor or major changes in how the because of some minor or major changes in how the

device interacts with the software. device interacts with the software.

Page 56: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Changing a Driver’s Changing a Driver’s Configuration (Configuration ( 配置配置 // 设置设置 ))

Driver operate in a Driver operate in a particular fashionparticular fashion 以特定方式工作以特定方式工作include operations to include operations to customize its functionscustomize its functions for a for a specific user or system requirement specific user or system requirement 功能定制功能定制– Transfer speed of a modemTransfer speed of a modem– Amount of data to bufferAmount of data to buffer– Protocols to be usedProtocols to be used

User OrientationUser Orientation– Screen resolutionScreen resolution– Wallpaper to displayWallpaper to display– whether the mouse should function as a left-whether the mouse should function as a left-

handed mouse.handed mouse.

Page 57: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Changing a Driver’s Configuration Changing a Driver’s Configuration (continued)(continued)

OS like OS like UNIXUNIX keeps all the configuration information keeps all the configuration information in the form of in the form of text filestext files..

Present version of Present version of windowswindows store configuration in store configuration in binary filesbinary files, which are collectively known as , which are collectively known as Registry(Registry( 注册表注册表 ))..– Registry has its own editor (either Registry has its own editor (either REGEDITREGEDIT or or

REG32EDIT) for viewing and modifying the information.REG32EDIT) for viewing and modifying the information.– It is It is cryptic in nature(cryptic in nature( 难以理解与掌握难以理解与掌握 )), novice users , novice users

employ the employ the control panelcontrol panel to modify contents of registries. to modify contents of registries.– UtilitiesUtilities exist for backup, restoring, or before changes are exist for backup, restoring, or before changes are

made to the hardware. made to the hardware. 注册表管理工具注册表管理工具

Page 58: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Plug and Play Plug and Play 即插即用即插即用When you are installing a new hardware device When you are installing a new hardware device under under WindowsWindows, it most likely will be detected after a , it most likely will be detected after a boot by the boot by the Plug and Play (PnP) control mechanismPlug and Play (PnP) control mechanism. .

If the device supports PnP, Windows should If the device supports PnP, Windows should inform inform you that it found a new device and should ask you you that it found a new device and should ask you for the location of the driverfor the location of the driver. .

The driver can The driver can – either be part of the Windows distribution itself (requiring either be part of the Windows distribution itself (requiring

you to use the Windows CD), a floppy, a CD, OSyou to use the Windows CD), a floppy, a CD, OS 自带自带– or a folder on the hard disk where you previously or a folder on the hard disk where you previously

downloaded the driver from the Internet. downloaded the driver from the Internet. 硬件厂商提供硬件厂商提供

Page 59: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Plug and Play Plug and Play 即插即用即插即用if Windows does not recognize a newly if Windows does not recognize a newly added device added device

Use Use Add New HardwareAdd New Hardware utility. utility. 没有检测到设备时没有检测到设备时的方法的方法

If an appropriate driver is not foundIf an appropriate driver is not found– Windows will be Windows will be unable to use unable to use the device.the device.

Page 60: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Plug and PlayPlug and Play

Page 61: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

What if Plug and Play Does not What if Plug and Play Does not work?work?

Page 62: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Changing Keyboard OptionsChanging Keyboard Options

Select Keyboard icon, then File, then Open

Page 63: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Changing Keyboard Options Changing Keyboard Options (continued)(continued)

Changes can be made to keyboard speed and language

Page 64: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.2.3 Configuration3.2.3 Configuration

Page 65: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Operating System ConfigurationOperating System ConfigurationUnder folder options a change can be made to the Desk Top look and feel

Page 66: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.2.4 Lab: Device Management3.2.4 Lab: Device Management

Page 67: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.3 Resource Sharing3.3 Resource Sharing

3.3.1 Virtual Memory 3.3.1 Virtual Memory

3.3.2 File and Printer Sharing 3.3.2 File and Printer Sharing

xqw
322-324自行阅读及上机实践
Page 68: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.3.1 Virtual Memory3.3.1 Virtual Memory

Managing Memory Managing Memory

Relocation Relocation

Virtual Memory Virtual Memory

Page 69: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Resource SharingResource Sharing

Multitasking(Multitasking( 多任务管理多任务管理 )) is sharing the processor is sharing the processor so that several tasks so that several tasks appear to execute appear to execute simultaneously on a single CPUsimultaneously on a single CPU..

Resources like Resources like memory, files, and printersmemory, files, and printers can be can be shared.shared.

MemoryMemory– Processes shares the available memory on a Processes shares the available memory on a

computer computer – System juggles System juggles memory pagesmemory pages between RAM and between RAM and

disk if there is no sufficient RAM disk if there is no sufficient RAM 主辅存间切换主辅存间切换– This scheme(This scheme( 方案方案 ) is ) is Virtual Memory(Virtual Memory( 虚拟内存虚拟内存 ))..

Page 70: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Managing MemoryManaging MemoryManaging the system's memory Managing the system's memory is an important job is an important job of the kernelof the kernel. . A typical personal computer today will have A typical personal computer today will have 64 MB 64 MB or more of main memory (DRAM).or more of main memory (DRAM). – Some of that is reserved for the operating system, Some of that is reserved for the operating system, – but but most of itmost of it is available for user programs. is available for user programs.

Let us say a user is running a Let us say a user is running a Web browser, an Web browser, an editor, and a computer gameeditor, and a computer game. . – Each of these programs needs a certain amount of Each of these programs needs a certain amount of

memory, but memory, but none of them needs access to all the none of them needs access to all the memory.memory. 每个程序都不会占用全部内存每个程序都不会占用全部内存

– The kernel The kernel allocates some memory to each program and allocates some memory to each program and keeps track of what program is using what.keeps track of what program is using what.

Page 71: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

real address spacereal address space

Modern OS such as Modern OS such as Linux and WindowsLinux and Windows provide provide virtual memoryvirtual memory, to increase program , to increase program flexibility. flexibility.

To understand why virtual memory is useful, To understand why virtual memory is useful, let us start by looking at how let us start by looking at how olderolder operating operating systemssystems like like MS-DOS MS-DOS worked. worked. – In those systems, all programs ran in In those systems, all programs ran in the samethe same

real address space(real address space( 实地址空间实地址空间 )), since there , since there was no was no virtual address spacevirtual address space..

Page 72: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

real address spacereal address spaceBoth instructions and data contain memory Both instructions and data contain memory addresses. addresses. So when So when – write a program in machine code or write a program in machine code or – a compiler translates high-level language into a compiler translates high-level language into

machine code machine code you (or the compiler) must calculate the address for you (or the compiler) must calculate the address for every instruction and every piece of data.every instruction and every piece of data.

Page 73: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

real address spacereal address spaceyou start at 0 and lay out all your instructions you start at 0 and lay out all your instructions and data in sequence, so your entire program and data in sequence, so your entire program occupies memory addresses 0 through 8,462. occupies memory addresses 0 through 8,462. Now, suppose everyone else writes their Now, suppose everyone else writes their programs the same way, starting at address programs the same way, starting at address 0. 0. Obviously, you Obviously, you cannot run two programscannot run two programs that that occupyoccupy the same memory addresses the same memory addresses at theat the same time same time with this scheme with this scheme – since as soon as you load the second one, it will since as soon as you load the second one, it will

overwrite the first. overwrite the first. 把前面的程序覆盖了!把前面的程序覆盖了!

Page 74: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Relocation Relocation 重定位重定位Executable programsExecutable programs (( 可执行程序可执行程序 )) written in written in binary binary machine codemachine code (( 二进制机器码二进制机器码 ) ) contains instructions contains instructions and data whose storage locations are indicated by and data whose storage locations are indicated by memory addresses(memory addresses( 内存地址内存地址 ))..

Any memory location that contains an address is Any memory location that contains an address is specially marked in a specially marked in a binary file(binary file( 二进制文件二进制文件 )). .

When a user runs the programWhen a user runs the program– OS allocates memory(OS allocates memory( 分配内存分配内存 )) for it and loads for it and loads

into the allocated memory area.into the allocated memory area.– OS OS updates allupdates all the the memory referencesmemory references (( 内存引内存引

用用 )) so that they so that they point to the correct locations.point to the correct locations.

Page 75: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

RelocationRelocation

0

100

500

600

LOAD 1, 500

12345

500

1000

1000

1100

1500

1600

LOAD 1, 500

12345

主存

有效地址

基址寄存器

Page 76: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Relocation (continued)Relocation (continued)

Advantages :Advantages :– Simple to implement Simple to implement 易于实现易于实现– Does not require any change in the hardwareDoes not require any change in the hardware

Disadvantages:Disadvantages:– Memory allocated to program Memory allocated to program should be should be

contiguous (contiguous ( 连续连续 ))– Size of running programSize of running program is limited to the amount is limited to the amount

of physical memoryof physical memory installed on the machine installed on the machine

Page 77: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Virtual Memory Virtual Memory 虚拟内存虚拟内存Typical PC has 128MB memory or moreTypical PC has 128MB memory or more..– Some memory are assigned to the OS and Some memory are assigned to the OS and – the remainder for user programs.the remainder for user programs.

The kernel (OS The kernel (OS 内核内核 ))– allocates memory and allocates memory and – keeps track of the memory spaces used by each keeps track of the memory spaces used by each

program.program.

Page 78: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Virtual Memory Virtual Memory 虚拟内存虚拟内存To increase program flexibility, To increase program flexibility, virtual memoryvirtual memory scheme is used by scheme is used by WindowsWindows and and LinuxLinux..– a small amounta small amount of RAM is required for a program to run of RAM is required for a program to run

and and – the the rest rest of the program’s address spaceof the program’s address space is kept on the is kept on the

disk. disk. 不需要一次将所有程序调入内存不需要一次将所有程序调入内存In a system that uses virtual memoryIn a system that uses virtual memory– every program every program runs in its own private address space.runs in its own private address space.

Virtual address space(Virtual address space( 虚拟地址空间虚拟地址空间 )) can can be larger be larger than processor’s physical memory.than processor’s physical memory. Why? Why? 硬盘!硬盘!

Page 79: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Virtual Memory (continued)Virtual Memory (continued)

In virtual memory scheme, memory is divided into In virtual memory scheme, memory is divided into pages (pages ( 页面页面 ))– the the smallest unitsmallest unit of memory allocated for a program. of memory allocated for a program.

A processor works in two modesA processor works in two modes– In In real modereal mode, addresses refer to the physical locations in , addresses refer to the physical locations in

RAM. RAM. Only the Only the kernelkernel runs in real mode. runs in real mode.– In In virtual modevirtual mode, a , a page table(page table( 页面表页面表 )) provides a provides a

mapping between each physical address and virtual mapping between each physical address and virtual address.address.

For every For every physical location(physical location( 实际地址实际地址 )) in RAM, in RAM, there is an entry in the page table.there is an entry in the page table.

Page 80: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.
Page 81: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Virtual Memory (continued)Virtual Memory (continued)

A A page tablepage table is used for every program is used for every program maintained by the Kernel.maintained by the Kernel.

User Programs are User Programs are not aware ofnot aware of all the virtual all the virtual memory schemememory scheme

EntireEntire program is program is not loaded into the memory at not loaded into the memory at once. once. – For the pages decided not to load, there is a For the pages decided not to load, there is a

special marker indicating “special marker indicating “PAGE NOT IN RAMPAGE NOT IN RAM””

Page 82: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Virtual Memory (continued)Virtual Memory (continued)

Page Fault(页面错误) Generated when a memory translation circuitry( 内存转换电路 ) checks the page table and finds a “NOT IN RAM” marker.

This is a kind of interrupt– processor stops executing the user program.– Control is passed to the Kernel.– Kernel checks where the page fault came from

and loads the specific program, allocating needed RAM.

Page 83: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

在线教程上的在线教程上的演示程序演示程序

Page 84: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Virtual Memory (continued)Virtual Memory (continued)Advantages:Advantages:– The program does The program does not need to be loaded not need to be loaded

contiguouslycontiguously into RAM. into RAM. – The program does The program does not need to be loaded completelynot need to be loaded completely

into RAM. into RAM. – The program does The program does not need to start at a specific not need to start at a specific

physical addressphysical address. . Disadvantages:Disadvantages:– Can Can slow accessslow access to data to data becausebecause it is stored on the it is stored on the

hard drivehard drive which is significantly which is significantly slower than physical slower than physical RAMRAM. .

– Keeps the hard disk busyKeeps the hard disk busy, , delayingdelaying access to( access to( 访问访问 ) ) other filesother files

Page 85: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.3.2 File and Printer Sharing3.3.2 File and Printer Sharing

Files Files

Printers Printers

xqw
w102nd
Page 86: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Resource Sharing: FilesResource Sharing: Files

Files are shared Files are shared between applications and usersbetween applications and users in in a a networking environment (networking environment ( 网络环境网络环境 ))..

OS defines a set of permissions for files to prevent OS defines a set of permissions for files to prevent unauthorized access(unauthorized access( 未授权的访问未授权的访问 )) to files. to files.

Permissions include:Permissions include:– Read accessRead access: allows to read a file: allows to read a file– Write accessWrite access: allows to create, modify or delete a : allows to create, modify or delete a

filefile– Execute accessExecute access: allows to perform special : allows to perform special

operations such as viewing the contents of a operations such as viewing the contents of a directory or executing a programdirectory or executing a program

Page 87: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Resource Sharing - PrintersResource Sharing - PrintersCan be shared among applications, users, and Can be shared among applications, users, and machinesmachinesFiles to be printed are sent to a Files to be printed are sent to a print serverprint server, which , which maintains a list of files to be printedmaintains a list of files to be printedServer processes one request for printing at a timeServer processes one request for printing at a timePrint requests are stored on a disk in a process Print requests are stored on a disk in a process called called spooling(spooling(假脱机打印假脱机打印 ).).– Spooling allows the process issuing the print to continue Spooling allows the process issuing the print to continue

with other processes. with other processes. 允许多个进程同时发出打印命令允许多个进程同时发出打印命令– If a printer is connected to a network, print requests from If a printer is connected to a network, print requests from

other machines on the same network can be processed.other machines on the same network can be processed. 连在网上的打印机可以处理来自同网其它机器的打印请求连在网上的打印机可以处理来自同网其它机器的打印请求

Page 88: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Resource Sharing: Monitor, Keyboard, Resource Sharing: Monitor, Keyboard, and Mouseand Mouse

Monitor, keyboard, and mouse Monitor, keyboard, and mouse are shared when are shared when many tasks are running at the same timemany tasks are running at the same time..

This function is a part of the OS known as Window This function is a part of the OS known as Window System .System .– Tasks are Tasks are not displayed on the monitor directlynot displayed on the monitor directly..– Each task has one or more windows associated with itEach task has one or more windows associated with it for for

reading and writing data through the windows.reading and writing data through the windows.

Window SystemWindow System control the task’s window display. control the task’s window display.

User can change the arrangement of window by User can change the arrangement of window by resizing, minimizing, or maximizing the window.resizing, minimizing, or maximizing the window.

Page 89: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.4 File Systems3.4 File Systems

3.4.1 File Organization 3.4.1 File Organization

3.4.2 File Allocation Table and NT File 3.4.2 File Allocation Table and NT File SystemSystem

Page 90: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.4.1 File Organization3.4.1 File Organization

Files Files

Folders Folders

Drives Drives

Paths Paths

Shortcuts Shortcuts

File Names and Types File Names and Types

Page 91: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.
Page 92: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

File SystemsFile Systems

File SystemsFile Systems– System that an operating system or program uses to System that an operating system or program uses to

organize and keep track of files.organize and keep track of files.

A A filefile is is – a named collection of data existing on a storage medium.a named collection of data existing on a storage medium.

FilenameFilename is a unique set of letters and numbers that is a unique set of letters and numbers that identifies a file and describes the file contents.identifies a file and describes the file contents.

File File extensionsextensions (扩展名)(扩展名) indicate the category to indicate the category to which the file belongs, preceded with a which the file belongs, preceded with a dotdot.. (圆(圆点)点)

Page 93: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

File SystemsFile Systems

The maximum number of characters that a file The maximum number of characters that a file name can have is name can have is different for different different for different operating systemsoperating systems..

Wildcards(Wildcards( 通配符通配符 )) are used to represent are used to represent unknown group of characters in the filename unknown group of characters in the filename and the extension. and the extension. ( ( ** 与 与 ??))– ““newfile*”newfile*” means all the files whose name begin means all the files whose name begin

with “newfile” with “newfile” followed by whatever charactersfollowed by whatever characters in in the file name including extensions.the file name including extensions.

Page 94: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.
Page 95: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

File Systems (continued)File Systems (continued)Files can be of two typesFiles can be of two types– An An executable fileexecutable file containing program instructions that tell a computer containing program instructions that tell a computer

how to perform a specific task.how to perform a specific task.– Data fileData file containing words, numbers, or pictures that can be viewed, containing words, numbers, or pictures that can be viewed,

edited, saved, sent, or printed.edited, saved, sent, or printed.

Filename extensions fall into 2 categories:Filename extensions fall into 2 categories:– Generic filename extension (Generic filename extension ( 通用文件扩展名通用文件扩展名 )): indicates the general : indicates the general

type of data contained in a file, which can be opened with several type of data contained in a file, which can be opened with several software packages (software packages (e.g. .txte.g. .txt))

– Application-specific filename extension(Application-specific filename extension( 特殊应用扩展名特殊应用扩展名 )): associated : associated with specific application software and the application used to create with specific application software and the application used to create the file (the file (e.g. .doc, .ppte.g. .doc, .ppt))

Other type of files are essential for software and Other type of files are essential for software and hardware operations (hardware operations (e.g. .bat, .sys .cfg, .dlle.g. .bat, .sys .cfg, .dll).).

Page 96: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

File OrganizationFile Organization

File manager utility software helps us File manager utility software helps us locate, locate, rename, move, copy, and delete filesrename, move, copy, and delete files ( (e.g. e.g. 资源管理资源管理器器 ).).

Device LettersDevice Letters are identifications for storage devices are identifications for storage devices such as the such as the floppy disk drive, the hard disk drivefloppy disk drive, the hard disk drive, , and and CD-ROM or DVD drivesCD-ROM or DVD drives. . 盘符盘符Operating system maintains list of all the files in a Operating system maintains list of all the files in a ““directorydirectory” for each disk. ” for each disk. 目录目录– A A directorydirectory contains all the information about the file contains all the information about the file

including the filename, filename extension, date and time including the filename, filename extension, date and time the file was created, and the file size.the file was created, and the file size.

Page 97: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

File OrganizationFile OrganizationMain directoryMain directory: : root directory(root directory( 根目录根目录 )) that that contains useful list of all the files within the directory.contains useful list of all the files within the directory.FoldersFolders: organization of files into smaller groups to : organization of files into smaller groups to facilitate searching for the file(facilitate searching for the file( 便于查找文件便于查找文件 ))..File specification (path)File specification (path), includes the drive letter, , includes the drive letter, folder, Filename and an Extension to identifies a file.folder, Filename and an Extension to identifies a file.– C:\Ssd2\Text\demo.docC:\Ssd2\Text\demo.doc..

Drive LetterDrive Letter Folder Folder SubfolderSubfolder Filename Filename ExtensionExtensionNames of folders are differentiated from drive letters Names of folders are differentiated from drive letters and files separated by the backslash symbol(and files separated by the backslash symbol( 反斜反斜杠杠 ) ) ““\\”” ((Dos & WindowsDos & Windows).).

Page 98: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Hierarchical File SystemHierarchical File System

Represents a Represents a tree structuretree structure in which directories in which directories have files and subdirectories beneath them.have files and subdirectories beneath them.

Folder

Sub folder

Root Folder

File

File

Page 99: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

File Management MetaphorsFile Management Metaphors

Page 100: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

3.4.2 File Allocation Table and 3.4.2 File Allocation Table and NT File SystemNT File System

Clusters and File Allocation Tables Clusters and File Allocation Tables

FAT16 FAT16

FAT32 FAT32

NT File SystemNT File System

Page 101: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

File Allocation TableFile Allocation TableHard disks are divided into Hard disks are divided into tracks(tracks( 磁道磁道 )) and and sectors(sectors( 扇扇区区 ).).– Each sector contains 512 bytes.Each sector contains 512 bytes.

Small filesSmall files occupy fraction of sectors( occupy fraction of sectors( 部分扇区部分扇区 ), the ), the remaining sectors are called remaining sectors are called Slack SpaceSlack Space (未利用空(未利用空间)间)Large filesLarge files of ten million bytes require thousands of of ten million bytes require thousands of sectors spread across multiple tracks.sectors spread across multiple tracks.

硬盘同心圆 光盘螺旋线

Page 102: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

File Allocation TableFile Allocation TableSectors are grouped into Sectors are grouped into clusters(clusters( 簇簇 ).).其实不是按扇其实不是按扇区分配的区分配的– Each cluster contains 4,8,16,32,64 Each cluster contains 4,8,16,32,64 adjacent(adjacent(相邻相邻 ))

sectors.sectors.– Cluster size depends on drive capacity.Cluster size depends on drive capacity.

File Allocation Table (FAT,File Allocation Table (FAT, 文件分配表文件分配表 ))– Contains an Contains an entry( 记录、条目 ) for every cluster for every cluster

on the disk.on the disk.– FAT gives each cluster the number of the next FAT gives each cluster the number of the next

cluster for that filecluster for that fileAll clusters in a file are All clusters in a file are chained togetherchained together..– All the clusters can be found when the first cluster is All the clusters can be found when the first cluster is

known. known. 只要知道文件的首个簇号即可找到整个文件只要知道文件的首个簇号即可找到整个文件

Page 103: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

FAT FAT 文件分配表文件分配表

Page 104: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

File Allocation Table (continued)File Allocation Table (continued)

FAT16FAT16– Uses Uses 16 bits16 bits per entry per entry– Allows up to 65,536 clustersAllows up to 65,536 clusters– Allows drives up to 2 GBAllows drives up to 2 GB

FAT 32FAT 32– Uses Uses 3232 bitsbits per entry per entry

– Supports drives up to 2 terabytesSupports drives up to 2 terabytes

Page 105: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

NT File SystemNT File System

NTFS (New Technology File System)NTFS (New Technology File System) is an is an improvement to the FAT file systems used in improvement to the FAT file systems used in Windows 2000/NT/XP. Windows 2000/NT/XP.

No limitNo limit to the sector size to the sector size

Cluster size is variable(Cluster size is variable( 可变的可变的 )) depending depending on the size of the logical drives. on the size of the logical drives. – automatically determinedautomatically determined by the NTFS Format by the NTFS Format

utility, utility, providing a level of flexibilityproviding a level of flexibility not available in not available in FAT16 or FAT32. FAT16 or FAT32.

– More efficient allocation of disk spaceMore efficient allocation of disk space

Page 106: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.
Page 107: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

NT File SystemNT File SystemRecoverability Recoverability 可恢复性可恢复性– maintains the consistency of data using maintains the consistency of data using journaling (journaling ( 日志记日志记

录录 )):: keeping a log of each I/O operation that modifies a system file keeping a log of each I/O operation that modifies a system file within a logical drivewithin a logical drive. . 记录读写操作,记录读写操作,If the system fails, the file directory structure can be recovered If the system fails, the file directory structure can be recovered based on the history of the I/O operations performed on the file based on the history of the I/O operations performed on the file system. system. 需要时可恢复需要时可恢复

Includes Includes Encrypted Files System (EFS,Encrypted Files System (EFS, 加密文件系加密文件系统统 ),), – which enables data to be encrypted as it is saved to disk. which enables data to be encrypted as it is saved to disk.

Supports data access control and ownership Supports data access control and ownership privilegesprivileges (( 文件访问控制及所有权管理文件访问控制及所有权管理 )) – to to restrict unauthorized accessrestrict unauthorized access to data in a multi-user to data in a multi-user

environmentenvironment

Page 108: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

Physical File StoragePhysical File StorageFragmented files(Fragmented files( 文件碎片文件碎片 )) are stored in noncontiguous are stored in noncontiguous clusters and clusters and decrease performance(xdecrease performance(x 性能降低性能降低 ))

Defragmentation utilities (Defragmentation utilities ( 磁盘碎片整理程序磁盘碎片整理程序 )) rearrange files rearrange files so that they are stored in contiguous clustersso that they are stored in contiguous clusters

Page 109: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

compares NTFS and FAT files compares NTFS and FAT files systems systems

  NTFS FAT32 FAT16

Operating System

Windows XPWindows 2000Windows NT

Windows XPWindows 2000Windows 98Windows MEWindows 95 OEM

Service Release 2 (OSR2)

All versions of Microsoft Windows DOS

Max Volume Size 2 TB 32 GB 2 GB

Files per Volume ~ 4 billion ~ 4 million ~ 64,000

Max File Size 2 TB 4 GB 2 GB

Page 110: Unit 3. Operating System Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific.

END of Unit 3END of Unit 3


Recommended