You are on page 1of 106

Unit 3.

Operating System
Software
An operating system performs a vital role in enabling
users to interact with a computer system.
the specific responsibilities of an operating system
– device management,
– memory management,
– resource sharing, and
– process control.
After learning, you will understand
– some of the problems that can cause your computer to
perform less than optimally and
– some of the solutions that can resolve those problems.
– learn how to customize your computing environment to
your personal taste.
contents
3.1 Structure
3.2 Device Management and Configuration
3.3 Resource sharing
3.4 File Systems
3.1 Structure
3.1.1 Layers of Software
3.1.2 The BIOS: Life at the Bottom.
3.1.3 Process Control.
3.1.4 Lab: Task Manager.
software has its own structure
Just as we previously discussed with respect to hardware, a
computer system's software has its own structure.
The operating system is not a single entity but is composed
of multiple layers( 多层 ), each with its own area of
responsibility.
The operating system's layers and the applications the user
runs are considered unique "tasks" or "processes,"
– competing for access to the CPU and other hardware
resources.
The management of this competition through
– the proper scheduling of processes is a major
responsibility of an operating system and
– can have a significant impact on system performance.
3.1.1 Layers of Software
Layers and Process Management
Encapsulation and Abstraction
Layers of Software
Software systems are composed of
multiple layers
the same can be found many features of everyday
life
Example.
第一层 学生 用餐

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

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

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

第五层 农民 种粮种菜
Encapsulation and Abstraction
Encapsulation (封装) means that each
layer needs only a limited amount of knowledge
to do its job
– Organizing software into layers that are relatively
independent 各司其职
keep the entire system manageable, and
afford greater efficiencies
Abstraction (抽象) means how the software
layers communicate, beyond the view of the user
Layers of Software
Top User-Written Scripts
User Interface
Application
Run-time Library
Application Program Interface
Operating System
Kernel
Device Drivers
BIOS
Bottom Hardware
Layers of Software (continued)
Hardware:
– Lowest level of the computer
– The physical components (物理器件) from
which the computer system is constructed
BIOS (Basic Input/Output System):
– Most primitive level of software
– Deals directly with the signals that control each
hardware component
– Most of its work is done when the system first
boots up
Layers of Software (continued)
Device drivers:
– Helper programs used by Operating systems to
control a device
– In order to add new hardware, the appropriate
device driver must be present.
– Provided by the device manufacturer in floppies
or other storage media
– Instructions are to be followed to install the device
and its drivers.
– Windows OS may sometimes have such drivers
stored.
Layers of Software (continued)
kernel:
– Performs functions that are critical to maintaining
the operating system
– The kernel is responsible for
Memory management
Process and task management
Disk management. (File System)
Interrupt Handling
– Resident in RAM at all times
– Because space is a factor, the kernel is kept small
Layers of Software: Operating
System
Operating System (OS):
– Implements all other functions the OS is to perform
File system management
Communicates with the kernel when basic actions such
as data transfer operation to a peripheral
– Master controller of all the activities of the computer
– Sets standards for all the application software used in a
computer system
– Different operating systems have different user interfaces
and run compatible applications
Examples: Microsoft Windows, UNIX, LINUX, Mac OS
Layers of Software: Operating System
(continued)
External Services of OS:
– Help users start programs
– Manage stored data
– Maintain security of the system
– Provides ways to
select an application program,
find, rename and delete documents and other data
stored on disk
Layers of Software: Operating System
(continued)
Internal services of OS:
– controls input and output
– Allocates system resources (e.g. memory, disk
drive capacity, processor time)
– Manages storage for programs and data
– Detects equipment failures( 设备故障 )
Layers of Software: Operating System
(continued)
Operating systems can be classified into two
categories.
– A server( 服务器 ) operating system is designed
for computers that provide
centralized storage facilities( 集中式存储设备 ) and
communications capabilities for networks and Web
sites.
– A desktop operating system is designed for a
single-user microcomputer( 微机 ).
Layers of Software (continued)
Application Program Interface (API):
– A set of routines, protocols, and tools for building software
applications
– Abstraction defined by OS to manage memory for
applications
– Application communicates with OS through the API.
Run time Libraries( 运行时程序库 ):
– A library of routines that are bound( 绑定 ) to the program
during execution
– Collection of Software routines which application programs
rely on
– Functions that make appropriate API calls needed to
enable the OS to perform accordingly
Layers of Software (continued)
Application ( 应用程序 ):
– Layer where the routines perform tasks the application is
designed to do.
User interface ( 用户接口,用户界面 ):
– Responsible for the communication between the
application and the user
– Typically it is a GUI, composed of buttons and pull-down
menus
– The GUI passes the information on to the application
Layers of Software (continued)
Scripts (脚本) or macros (宏) :
– Routines that many applications use to allow users to
create documents using the application’s built-in
commands.
– Allow users to automate sequences of actions they
perform frequently
– Can perform any function that does not require additional
user input
网页脚本
VBA 宏
Layers of Software (continued)
The computer industry relies on specialists in
each layer of software.
– Some people make their living writing BIOS
software.
– Others concentrate on improving GUI technology.
– The greatest number of programmers are found
at the application level.
Windows OS
Windows 95/98/NT/ME/2000/XP
– Widely used in PCs
– Supports vast applications and peripheral devices
– Provides icons, buttons, menus and various other graphical
objects that can be manipulated by a mouse
– Provides a command-line interface
– Supports multitasking
– Designed to run high-end and complicated tasks such as
video editing, scientific visualization, and CAD (computer
aided design)
Provide reliability, security, and support for software
applications
Mac OS
Introduced By APPLE computers
Contains graphical user interface featuring menus
and icons
OS interface through keyboard or mouse
Software applications that are compatible with Mac
OS are called Mac software.
Fewer software are compatible with Mac OS than
Windows OS.
Mac OS has good graphical application software
support.
Some hardware and software add-ons( 附加硬件软
件 ) enable Windows software to run on Mac OS.
Mac OS (continued)
In 1984, Apple Computer introduced the
revolutionary Lisa computer.
The Macintosh computer, with its graphical
user interface, Mac OS, was a major factor
contributing to its success.

The iMac
computer
DOS
DOS stands for disk operating system.
– Developed by Microsoft and introduced in IBM-PC.
– Uses command-line interface.
– Has been incorporated into Windows OS
– Operates behind the scenes so Windows users do not
have to memorize and type complex commands
Windows Server, NetWare, UNIX and
LINUX
Computer providing centralized storage and
communications services requires Server OS
– similar to Desktop OS : User interface and appearance
– Differs : managing large flow of data on large networks
and web sites
Novell NetWare: developed for micro computer
network
– Used to access documents and data files in a
centralized storage
– Handled by network managers rather than by
average computer users
Windows Server, NetWare, UNIX and
LINUX (continued)
UNIX and LINUX:
– Developed for mini and micro computer networks
and web servers of all sizes.
– Variation of UNIX is LINUX, which is has a stable
and secure OS.
– UNIX and LINUX are suitable for servers and high-
end workstations.
– A GUI environment is provided in UNIX and LINUX
for ease of operation.
Handheld Operating Systems
Utilities
Subcategory of system software to
augment( 增强功能 ) OS
– Allow users to control the hardware resources
and allocation
Some Utilities comes with OS such as
– Providing information about files on the disk
– Preparing disk to hold data
– Copy files from one disk to another
Utilities (continued)
Utility Software protects computer from viruses that erase or
damage your data.
Norton Utilities:
– Retrieves data from damaged disk, encrypt it and helps
troubleshoot the problem
OS provides disk formatting utility to format disks.
Formatting disk:
– Creating electronic storage shelves for data
It is safe to format even a pre-formatted disk or a disk
formatted for another OS.
3.1.2 The BIOS: Life at the
Bottom
The Role of the BIOS
Changing BIOS Settings
The Roles of the BIOS
The BIOS performs 3 major functions
– initializes hardware when the computer is first turned on
– loads the O/S
– provides basic support for devices such as the keyboard, mouse,
and serial ports
The BIOS resides on a ROM chip
– Non-volatile
– Slower than DRAM
Loads itself into DRAM
Uses CMOS
– CMOS is powered by battery, therefore, it is volatile
– Contains BIOS parameter settings for hardware and memory
speed
BIOS (continued)
The BIOS initiates the POST (Power-On Self Test) sequence
– Enables the video card
– Counts and tests memory
– Checks for expansion cards and adapters( 适配器 ) and
initializes them
– Follows a search order to find the MBR (Master Boot
Record)
A program is invoked to load the operating system
once the MBR is found
Bootable Floppy
Boot disk ( 启动盘 ) is a floppy containing bootable
copy of OS.
Used in the case of hard drive corruption when the
system crashes.
Computer that can be booted by a floppy is not fully
secure.
– Anyone can boot their version of OS, which ignores the file
protections and can access any file on the system.
– MBR (Master Boot Record) viruses affect the Boot disk.
The Boot Process
Changing BIOS Settings
To change BIOS settings, you must enter the BIOS setup
program during the boot sequence, by pressing a specified
key or key combination, such as F2 or ALT+CTRL+ESC.
The initial message the BIOS displays will tell you what keys
to press.
The setup program
– shows the current BIOS settings and
– allows to change them.
It stores the new settings in CMOS memory so they will be
available the next time the machine is turned on.
take Care ! when modifying BIOS settings,
– because the wrong settings can make the computer unusable.
– CIH 病毒
Where does a computer store its
basic hardware settings?
3.1.3 Process Control
Process Control
Keeps track of all the processes( 进程 ) running
Process is an instance of a running program
Process can be in three states:
– Running 运行
– Runnable 就绪
– Blocked 阻塞
Kernel maintains a queue of processes (also called
the run queue, or waiting list of runnable processes)
Preemptive Multitasking
Preemptive multitasking( 抢占式多任务处理 ) is used to
create an illusion that all the processes are running at
once.
Uses a real-time clock that can generate interrupts at
regular rate.
– At each interrupt, another process may be run. 当前正在运行的
任务的控制权被抢占,故名
Kernel checks whether a process should be given a
chance to run.
Kernel requires a context swap( 运行环境交换 ) for
switching processes( 待交换的进程 ).
Context switching places some over head ( 经常性的额
外消耗 ) on the processor.
Context Switching
Current running process is demoted( 降级 ) from
running to runnable.
The steps of context swap :
– Processor flushes( 清空 ) the pipeline of
executing instructions.
– Its execution process is noted.
– Register contents( 寄存器内容 ) are saved.
– Kernel loads a new page table( 页面表 ).
Context Swaps are done often to ensure that all
the process are given an opportunity to run.
3.1.4 Lab: The Task Manager
Using the Windows NT/2000 Task Manager
Examine processes that are running, the
number of threads a process has, system
performance, and page faults.
Windows 9x/Me has a simpler task manager,
but it can still show running processes.
3.2 Device Management and
Configuration
3.2.1 Interrupt Handling.
3.2.2 Hardware Attributes
3.2.3 Configuration.
3.2.4 Lab: Device Management
3.2.1 Interrupt Handling
Interrupts
Interrupt Priority and Nested Interrupts
Traps and Faults
Interrupts 中断
A signal informing a program that an event has
occurred.
Interrupt signals( 中断信号 ) can come from a
variety of sources.
– Hardware interrupts
– Software interrupts
To avoid losing of data, interrupts are handled
in less than a 1/1000 s.
PCs support 256 types of software interrupts
and 15 hardware interrupts. ( 有哪些上网查查 )
Interrupts (continued)
Processor receives an IRQ(Interrupt
ReQuest)
When the processor receives a interrupt, it
– Stops executing the current application
– Saves the address of the last instruction executed
– Jumps to a fixed memory location (e.g. address of
keyboard interrupt handler)
– Starts executing the instructions it finds there in
the new memory location
Interrupts (continued)
– Processor’s registers contain data the user program was
manipulating at the time.
Interrupt Handler must save the contents of registers before it
saves the register for its own purposes.
– Examines the state of the keyboard interface
– Accepts the byte of incoming data
– Places the byte in a storage area
– The byte is checked by the keyboard driver the next time it
runs.
– The keyboard interrupt handler restores the contents of
the saved registers .
– Transfers control back to the previous task it was
executing.
Interrupt Priority
The processor assigns priorities( 优先级 ) to
different types of interrupts.
– 在寝室看书时下雨了,收衣服还是受邀去看电影

Processor assigns priorities to different types


of interrupts.
– Low speed devices have low priority.
– High Speed devices have high priority.
Nested Interrupts
Interrupts in Interrupts handler
– Homework  look up dictionary  answer phone
 ……
Interrupts cannot nest infinitely.
Interrupt handler can only be interrupted by a
higher priority interrupt.
Trap ( 错误 ) 捕捉
A trap is an event similar to an interrupt,
– Interrupt being triggered by an external signal,
Triggered( 触发 ) by the execution of processor
instructions 指令执行错误
– An example is a division-by-zero operation
Processor traps the errors
– similar to an interrupt
– but without time pressure.
Trap handler( 错误处理程序 ) responds to an error
– either by printing a message
– or continuing with the program.
Fault 故障
Occurs when:
– The hardware is asked to perform a task that is not
possible for the hardware devices 硬件出了状况
non-existent memory location
Memory correction circuitry detects an uncorrectable
error
Attempting to divide by zero
Program contains an illegal machine instruction
Faults and traps are handled similarly
3.2.2 Hardware Attributes
Installing Drivers
Changing a Driver's Configuration
Installing Drivers
Each device must have a device driver in
the OS.
Device Driver ( 设备驱动程序 )
– manages the commands
– transfer of data
– error conditions that occur
Installing Drivers
OS specifies an interface that a device driver
must utilize 指定驱动程序使用的接口
– This means that for any particular device, it must
have a corresponding driver for the operating
system where it is intended to be used in order to
be functional. 所有设备必须具备驱动程序
– Different versions of the same OS may use an
interface requiring different drivers.
A similar but different product from the same company
will most likely require its own driver ? why
– because of some minor or major changes in how the device
interacts with the software.
Changing a Driver’s
Configuration ( 配置 / 设置 )
Driver operate in a particular fashion 以特定方式工作
include operations to customize its functions for a
specific user or system requirement 功能定制
– Transfer speed of a modem
– Amount of data to buffer
– Protocols to be used
User Orientation
– Screen resolution
– Wallpaper to display
– whether the mouse should function as a left-handed
mouse.
Changing a Driver’s Configuration
(continued)
OS like UNIX keeps all the configuration information
in the form of text files.
Present version of windows store configuration in
binary files, which are collectively known as
Registry( 注册表 ).
– Registry has its own editor (either REGEDIT or
REG32EDIT) for viewing and modifying the information.
– It is cryptic in nature( 难以理解与掌握 ), novice users
employ the control panel to modify contents of registries.
– Utilities exist for backup, restoring, or before changes are
made to the hardware. 注册表管理工具
Plug and Play 即插即用
When you are installing a new hardware device
under Windows, it most likely will be detected after a
boot by the Plug and Play (PnP) control mechanism.
If the device supports PnP, Windows should inform
you that it found a new device and should ask you
for the location of the driver.
The driver can
– either be part of the Windows distribution itself (requiring
you to use the Windows CD), a floppy, a CD, OS 自带
– or a folder on the hard disk where you previously
downloaded the driver from the Internet. 硬件厂商提供
Plug and Play 即插即用
if Windows does not recognize a newly
added device
Use Add New Hardware utility. 没有检测到设备时
的方法
If an appropriate driver is not found
– Windows will be unable to use the device.
Plug and Play
What if Plug and Play Does not
work?
Changing Keyboard Options
Select
Keyboard
icon, then
File, then
Open
Changing Keyboard Options
(continued)

Changes
can be
made to
keyboard
speed and
language
3.2.3 Configuration
Operating System Configuration
Under folder
options a
change can
be made to
the Desk
Top look
and feel
3.2.4 Lab: Device Management
3.3 Resource Sharing
3.3.1 Virtual Memory
3.3.2 File and Printer Sharing
3.3.1 Virtual Memory
Managing Memory
Relocation
Virtual Memory
Resource Sharing
Multitasking( 多任务管理 ) is sharing the processor
so that several tasks appear to execute
simultaneously on a single CPU.
Resources like memory, files, and printers can be
shared.
Memory
– Processes shares the available memory on a
computer
– System juggles memory pages between RAM and
disk if there is no sufficient RAM
– This scheme( 方案 ) is Virtual Memory( 虚拟内存 ).
Managing Memory
Managing the system's memory is an important job
of the kernel.
A typical personal computer today will have 64 MB
or more of main memory (DRAM).
– Some of that is reserved for the operating system,
– but most of it is available for user programs.
Let us say a user is running a Web browser, an
editor, and a computer game.
– Each of these programs needs a certain amount of
memory, but none of them needs access to all the
memory. 每个程序都不会占用全部内存
– The kernel allocates some memory to each program and
keeps track of what program is using what.
real address space
Modern OS such as Linux and Windows
provide virtual memory, to increase program
flexibility.
To understand why virtual memory is useful,
let us start by looking at how older operating
systems like MS-DOS worked.
– In those systems, all programs ran in the same
real address space( 实地址空间 ), since there
was no virtual address space.
real address space
Both instructions and data contain memory
addresses.
So when
– write a program in machine code or
– a compiler translates high-level language into
machine code
you (or the compiler) must calculate the address for
every instruction and every piece of data.
real address space
you start at 0 and lay out all your instructions
and data in sequence, so your entire program
occupies memory addresses 0 through 8,462.
Now, suppose everyone else writes their
programs the same way, starting at address
0.
Obviously, you cannot run two programs that
occupy the same memory addresses at the
same time with this scheme
– since as soon as you load the second one, it will
overwrite the first. 把前面的程序覆盖了!
Relocation 重定位
Executable programs ( 可执行程序 ) written in binary
machine code ( 二进制机器码 ) contains instructions
and data whose storage locations are indicated by
memory addresses( 内存地址 ).
Any memory location that contains an address is
specially marked in a binary file( 二进制文件 ).
When a user runs the program
– OS allocates memory( 分配内存 ) for it and loads
into the allocated memory area.
– OS updates all the memory references ( 内存引
用 ) so that they point to the correct locations.
Relocation
基址寄存器
0
有效地址 1000
100
LOAD 1, 500 500 1000
1100
LOAD 1, 500
500
12345 1500
12345

600 1600

主存
Relocation (continued)
Advantages :
– Simple to implement 易于实现
– Does not require any change in the hardware
Disadvantages:
– Memory allocated to program should be
contiguous ( 连续 )
– Size of running program is limited to the amount
of physical memory installed on the machine
Virtual Memory 虚拟内存
Typical PC has 128MB memory or more.
– Some memory are assigned to the OS and
– the remainder for user programs.
The kernel (OS 内核 )
– allocates memory and
– keeps track of the memory spaces used by each
program.
Virtual Memory 虚拟内存
To increase program flexibility, virtual memory
scheme is used by Windows and Linux.
– a small amount of RAM is required for a program to run
and
– the rest of the program’s address space is kept on the
disk. 不需要一次将所有程序调入内存
In a system that uses virtual memory
– every program runs in its own private address space.
Virtual address space( 虚拟地址空间 ) can be larger
than processor’s physical memory. Why? 硬盘!
Virtual Memory (continued)
In virtual memory scheme, memory is divided into
pages ( 页面 )
– the smallest unit of memory allocated for a program.
A processor works in two modes
– In real mode, addresses refer to the physical locations in
RAM. Only the kernel runs in real mode.
– In virtual mode, a page table( 页面表 ) provides a
mapping between each physical address and virtual
address.
For every physical location( 实际地址 ) in RAM,
there is an entry in the page table.
页 号 块 号
0 0
0 5
1 0 0 0
1 6 1 0 0 0
2 0 0 0
作 业1 的 2 0 0 0
0 2 5 1 8 L O A D 1 , 2 1 0 8
5 1 8L O A D 1 , 2 10 0 82 3 0 0 0
1 0 0 0
1 4
2 0 0 0 4 0 0 0
2 1 0 8 0 1 5 5 7 1 2 7
3 0 0 0 5 0 0 0
J O B 2

6 0 0 0
0
0 8
7 0 0 0
1 0 0 0
J O B 3
7 1 0 8 1 5 5 7 1
8 0 0 0
地 址 空 间 页 表
9 0 0 0

主 存 空 间
Virtual Memory (continued)
A page table is used for every program
maintained by the Kernel.
User Programs are not aware of all the virtual
memory scheme
Entire program is not loaded into the memory at
once.
– For the pages decided not to load, there is a
special marker indicating “PAGE NOT IN RAM”
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 and 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.
Virtual Memory (continued)
Advantages:
– The program does not need to be loaded
contiguously into RAM.
– The program does not need to be loaded completely
into RAM.
– The program does not need to start at a specific
physical address.
Disadvantages:
– Can slow access to data because it is stored on the
hard drive which is significantly slower than physical
RAM.
– Keeps the hard disk busy, delaying access to( 访问 )
other files
3.3.2 File and Printer Sharing
Files
Printers
Resource Sharing: Files
Files are shared between applications and users in
a networking environment ( 网络环境 ).
OS defines a set of permissions for files to prevent
unauthorized access( 未授权的访问 ) to files.
Permissions include:
– Read access: allows to read a file
– Write access: allows to modify or delete a file
– Execute access: allows to perform special
operations such as viewing the contents of a
directory or executing a program
Resource Sharing - Printers
Can be shared among applications, users, and
machines
Files to be printed are sent to a print server, which
maintains a list of files to be printed
Server processes one request for printing at a time
Print requests are stored on a disk in a process
called spooling( 假脱机打印 ).
– Spooling allows the process issuing the print to continue
with other processes. 允许多个进程同时发出打印命令
– If a printer is connected to a network, print requests from
other machines on the same network can be processed.
连在网上的打印机可以处理来自同网其它机器的打印请求
Resource Sharing: Monitor, Keyboard,
and Mouse
Monitor, keyboard, and mouse are shared when
many tasks are running at the same time.
This function is a part of the OS known as Window
System .
– Tasks are not displayed on the monitor directly.
– Each task has one or more windows associated with it for
reading and writing data through the windows.
Window System control the task’s window display.
User can change the arrangement of window by
resizing, minimizing, or maximizing the window.
3.4 File Systems
3.4.1 File Organization
3.4.2 File Allocation Table and NT File
System
3.4.1 File Organization
Files
Folders
Drives
Paths
Shortcuts
File Names and Types
File Systems
File Systems
– System that an operating system or program uses to organize and
keep track of files.
A file is
– a named collection of data existing on a storage medium.
Filename is a unique set of letters and numbers that identifies
a file and describes the file contents.
File extensions indicate the category to which the file
belongs, preceded with a dot.
The maximum number of characters that a file name can
have is different for different operating systems.
Wildcards( 通配符 ) are used to represent unknown group of
characters in the filename and the extension.
– “newfile*” means all the files whose name begin with “newfile”
followed by whatever characters in the file name including extensions.
File Systems (continued)
Files can be of two types
– An executable file containing program instructions that tell a computer
how to perform a specific task.
– Data file containing words, numbers, or pictures that can be viewed,
edited, saved, sent, or printed.
Filename extensions fall into 2 categories:
– Generic filename extension ( 普通文件扩展名 ): indicates the general
type of data contained in a file, which can be opened with several
software packages (e.g. .txt)
– Application-specific filename extension( 特殊应用扩展名 ): associated
with specific application software and the application used to create
the file (e.g. .doc, .ppt)
Other type of files are essential for software and
hardware operations (e.g. .bat, .sys .cfg, .dll).
File Organization
File manager utility software helps us locate,
rename, move, copy, and delete files (e.g. 资源管理
器 ).
Device Letters are identifications for storage devices
such as the floppy disk drive, the hard disk drive,
and CD-ROM or DVD drives.
Operating system maintains list of all the files in a
“directory” for each disk.
A directory contains all the information about the
file including the filename, filename extension, date
and time the file was created, and the file size.
File Organization
Main directory: root directory( 根目录 ) that
contains useful list of all the files within the directory.
Folders: organization of files into smaller groups to
facilitate searching for the file( 便于查找文件 ).
File specification (path), includes the drive letter,
folder, Filename and an Extension to identifies a file.
– C:\Ssd2\Text\demo.doc.

Drive Letter Folder Subfolder Filename Extension


Names of folders are differentiated from drive letters
and files separated by the backslash symbol( 反斜
杠 ) “\” (Dos & Windows).
Hierarchical File System
Represents a tree structure in which directories
have files and subdirectories beneath them.
Root Folder

Folder

Fil Sub
e folder

Fil
File Management Metaphors
3.4.2 File Allocation Table and
NT File System
Clusters and File Allocation Tables
FAT16
FAT32
NT File System
File Allocation Table
Hard disks are divided into tracks( 磁道 ) and sectors( 扇
区 ).
– Each sector contains 512 bytes.
Small files occupy fraction of sectors( 部分扇区 ), the
remaining sectors are called Slack Space (未利用空
间)
Large files of ten million bytes require thousands of
sectors spread across multiple tracks.
File Allocation Table
Sectors are grouped into clusters( 簇 ).
Each cluster contains 4,8,16,32,64 adjacent( 相邻 )
sectors.
Cluster size depends on drive capacity.
File Allocation Table (FAT, 文件分配表 )
– Contains an entry for every cluster on the disk.
– FAT gives each cluster the number of the next
cluster for that file
All clusters in a file are chained together.
– All the clusters can be found when the first cluster is
known.
File Allocation Table (continued)
FAT16
– Uses 16 bits per entry
– Allows up to 65,536 clusters
– Allows drives up to 2 GB
FAT 32
– Uses 32 bits per entry
– Supports drives up to 2 terabytes
NT File System
NTFS (New Technology File System) is an
improvement to the FAT file systems used in
Windows 2000/NT/XP.
No limit to the sector size
Cluster size is variable( 可变的 ) depending
on the size of the logical drives.
– automatically determined by the NTFS Format
utility, providing a level of flexibility not available in
FAT16 or FAT32.
– More efficient allocation of disk space
NT File System
Recoverability 可恢复性
– maintains the consistency of data using journaling :
keeping a log of each I/O operation that modifies a system
file within a logical drive.
– If the system fails, the file directory structure can be
recovered based on the history of the I/O operations
performed on the file system.
Includes Encrypted Files System (EFS, 加密文件系
统 ), which enables data to be encrypted as it is
saved to disk.
Supports data access control and ownership
privileges ( 文件访问控制及所有权管理 ) to restrict
unauthorized access to data in a multi-user
environment
Physical File Storage
Fragmented files( 文件碎片 ) are stored in noncontiguous
clusters and decrease performance(x 性能降低 )
Defragmentation utilities ( 磁盘碎片整理程序 ) rearrange files
so that they are stored in contiguous clusters
compares NTFS and FAT files
systems
NTFS FAT32 FAT16

Operating System Windows XP Windows XP All versions of


Windows 2000 Windows 2000 Microsoft Windows
Windows NT Windows 98 DOS
Windows ME
Windows 95 OEM
Service Release 2
(OSR2)

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


END of Unit 3

You might also like