Upload
phamxuyen
View
216
Download
0
Embed Size (px)
Citation preview
Operating SystemChapter 3
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
278
Outline• Components
• Windows
• File system
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
279
References• Computers are your future
Catherine Laberta
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
280
• Foundations of Computer ScienceBehrouz A. Forouzan, Firouz Mosharraf
Introduction• Computer = hardware + software
• Hardware = Physical equipment
• Software =
� operating system (controls the access to hardware by users)
� +
� application programs (use the computer hardware to solve problems)
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
281
Computer system
Hardware Software
Operating
system
Application
programs
Definition• An operating system is an interface between the hardware of a computer and the user (programs or humans) that facilitates the execution of other programs and the access to hardware and software resources.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
282
DefinitionExamples
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
283
Components• OS needs to manage different resources in a computer.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
284
OS
User
interface
Memory
managerProcess
manager
Device
manager
File
manager
ComponentsUser interface• User interface: program that accepts request from the users.
• In windows it’s called a window to denote that it is menu-driven and has a GUI (graphical user interface) component.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
285
Memory
OS
Program 1
Program 2
Program 3
Memory
OS
Program
ComponentsMemory manager• OS divided into 2 broad categories of memory management:
• Monoprogramming:
� most of the memory capacity is dedicated to a single program.
� The whole program is in memory for execution
• Multiprogramming
� More than one program is in memory at the same time
� Programs are executed concurrently
� The CPU switches rapidly between the programs (scheduler)
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
286
ComponentsProcess manager• Process – Job – program
• Job scheduler
• Process scheduler
• Synchronization – Deadlock – starvation
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
287
ComponentsFile manager• Controls access to files.
• Supervises the creation, deletion and modification of files.
• Controls the naming of files.
• Supervises the storage of files: how they are stored, where they are stored.
• Is responsible for archiving and backups.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
288
Operatingsystem• Five basic functions
1. Starts the computer
2. Manages applications
3. Manages memory
4. Handles input and output device messages
5. Provides a user interface for communication
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
289
Operating system1- Bootstrap process• OS provides supports for other programs.
Example: loading other programs into memory for execution. The OS itself is a program that needs to be loaded into the memory and run. How this is solved?
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
290
Operating system1- Bootstrap process• The OS is stored in memory using ROM technology.A very small section of memory is made of ROM and holds a small program called the bootstrap program. This program is only responsible for loading the OS itself into RAM memory.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
291
Disk
Bootstrap program
Memory
CPU
Operating system
�
� �
ROM
1* Bootstrap program runs
2* OS system is loaded
3* OS system runs
Operating system2- Managing applications• Multitasking operating systems permit more than one application to run at the same time.
� The foreground application is the active one.
� Background applications appear inactive.
• Preemptive multitasking ensures that all applications have fair access to the CPU.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
292
Operating system2- Managing applications
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
293
Operating system3- Managing memory• A buffer, an area that holds data and instructions temporarily, makes programs run faster.
• RAM memory functions as the buffer.
• The OS gives each program a portion of RAM memory and keeps them from interfering with each other.
• Adding more RAM is often the best way to improve computer performance because accessing data from the hard disk is slower than accessing it from RAM.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
294
Operating system3- Managing memory
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
295
Operating system4- Handling input and output• Device drivers enable communication between the computer and the devices.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
296
Operating system5- Providing the user interface• The user interface allows the user to:
� Start application programs
� Manage storage devices
� Safely shut down the computer
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
297
a. Graphical user
interface
b. Menu-driven
user interface
c. Command-line
user interface
Windows
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
298
2015
Using your mouse• You will use the primary button most often.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
299
Using your mouseHolding and moving the mouse• Place your mouse beside your keyboard.
• Hold the mouse gently, with your index finger resting on the primary button and your thumb resting on the side.
• To move the mouse, slide it slowly in any direction. Don't twist it—keep the front of the mouse aimed away from you.
• As you move the mouse, a pointer on your screen moves in the same direction.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
300
Using your mousePointing, clicking, and dragging• Pointing to an item on the screen means moving your mouse so the pointer appears to be touching the item. When you point to something, a small box often appears that describes the item. For example, when you point to the Recycle Bin on the desktop, a box appears with this information: "Contains the files and folders that you have deleted."
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
301
Using your mousePointing, clicking, and dragging• There are four basic ways to use your mouse buttons:
� clicking,
� double-clicking,
� right-clicking,
� and dragging.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
302
Using your mousePointing, clicking, and dragging• Clicking (single-clicking)
• To click an item, point to the item on the screen, and then press and release the primary button (usually the left button).
• Clicking is most often used to select (mark) an item or open a menu.
• This is sometimes called single-clicking or left-clicking.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
303
Using your mousePointing, clicking, and dragging• Double-clicking
• To double-click an item, point to the item on the screen, and then click twice quickly. If the two clicks are spaced too far apart, they might be interpreted as two individual clicks rather than as one double-click.
• Double-clicking is most often used to open items on your desktop.
• For example, you can start a program or open a folder by double-clicking its icon on the desktop.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
304
Using your mousePointing, clicking, and dragging• Right-clicking
• To right-click an item, point to the item on the screen, and then press and release the secondary button (usually the right button).
• Right-clicking an item usually displays a list of things you can do with the item.
• For example, when you right-click the Recycle Bin on your desktop, you'll see a menu with options to open it, empty it, delete it, or see its properties. If you're ever unsure of what to do with something, right-click it.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
305
Using your mousePointing, clicking, and dragging• Dragging
• You can move items around your screen by dragging them. To drag an object, point to the object on the screen, press and hold the primary button, move the object to a new location, and then release the primary button.
• Dragging (sometimes called dragging and dropping) is most often used to move files and folders to a different location and to move windows and icons around on your screen.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
306
Using your keyboard• Your keyboard is the main way to enter information into your computer.
• You can also use your keyboard to control your computer by learning just a few simple keyboard commands (instructions to your computer) can help you work more efficiently.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
307
Using your keyboardHow the keys are organized• The keys on your keyboard can be divided into several groups based on function:
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
308
Using your keyboardTyping text• Whenever you need to type something in a program, e-mail message, or text box, you'll see a blinking vertical line (|). That's the cursor, also called the insertion point.
• In addition to letters, numerals, punctuation marks, and symbols, the typing keys also include Shift, Caps Lock, Tab, Enter, the Spacebar, and Backspace.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
309
Using your keyboardTyping text• Shift: Press Shift in combination with a letter to type an uppercase letter. Press Shift in combination with another key to type the symbol shown on the upper part of that key.
• Caps Lock: Press Caps Lock once to type all letters as uppercase. Press Caps Lock again to turn this function off. Your keyboard might have a light indicating whether Caps Lock is on.
• Tab: Press Tab to move the cursor several spaces forward. You can also press Tab to move to the next text box on a form.
• Enter: Press Enter to move the cursor to the beginning of the next line. In a dialog box, press Enter to select the highlighted button.
• Spacebar: Press the Spacebar to move the cursor one space forward.
• Backspace: Press Backspace to delete the character before the cursor, or the selected text. Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
310
Using your keyboardUsing keyboard shortcuts• Keyboard shortcuts are ways to perform actions by using your keyboard. They're called shortcuts because they help you work faster.
• Laster, a plus sign (+) between two or more keys indicates that those keys should be pressed in combination. For example, Ctrl+A means to press and hold Ctrl and then press A. Ctrl+Shift+A means to press and hold Ctrl and Shift and then press A.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
311
Using your keyboardFind program shortcuts• You can do things in most programs by using the keyboard. To see which commands have keyboard shortcuts, open a menu. The shortcuts (if available) are shown next to the menu items.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
312
Using your keyboardChoose menus, commands, and options• In a program that has menus with underlined letters, press Alt and an underlined letter to open the corresponding menu.
• Press the underlined letter in a menu item to choose that command.
• For programs that use the ribbon, such as Paint and WordPad, pressing Alt overlays (rather than underlines) a letter that can be pressed.
• This trick works in dialog boxes too. Whenever you see an underlined letter attached to an option in a dialog box, it means you can press Alt plus that letter to choose that option. Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
313
Using your keyboardUseful shortcuts• Windows logo key Picture of the Windows logo key : Open the Start menu
• Alt+Tab: Switch between open programs or windows
• Alt+F4: Close the active item, or exit the active program
• Ctrl+S: Save the current file or document (works in most programs)
• Ctrl+C: Copy the selected item
• Ctrl+X: Cut the selected item
• Ctrl+V: Paste the selected item
• Ctrl+Z: Undo an action
• Ctrl+A: Select all items in a document or window
• Esc: Cancel the current task
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
314
Using your keyboardUsing navigation keys / the numeric keypad• The navigation keys allow you to move the cursor, move around in documents and webpages, and edit text.
• To use the numeric keypad to enter numbers, press Num Lock. Most keyboards have a light that indicates whether Num Lock is on or off.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
315
Using your keyboardThree odd keys• PrtScn (or Print Screen): pressing PrtScn captures an image of your entire screen (a "screen shot") and copies it to the Clipboard in your computer's memory. From there you can paste it (Ctrl+V) into Microsoft Paint or another program and, if you want, print it from that program.
• ScrLk (or Scroll Lock): In most programs, pressing Scroll Lock has no effect. In a few programs, pressing Scroll Lock changes the behavior of the arrow keys and the Page Up and Page Down keys; pressing these keys causes the document to scroll without changing the position of the cursor or selection. Your keyboard might have a light indicating whether Scroll Lock is on.
• Pause/Break: This key is rarely used. In some older programs, pressing this key pauses the program or, in combination with Ctrl, stops it from running.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
316
The Desktop• The desktop is the main screen area that you see after you turn on your computer and log on to Windows.
• Like the top of an actual desk, it serves as a surface for your work.
• When you open programs or folders, they appear on the desktop.
• You can also put things on the desktop, such as files and folders, and arrange them however you want.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
317
Working with desktop icons• Icons are small pictures that represent files, folders, programs, and other items. When you first start Windows, you'll see at least one icon on your desktop: The Recycle Bin.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
318
Shortcuts• If you want easy access from the desktop to your favorite files or programs, you can create shortcuts to them. A shortcut is an icon that represents a link to an item, rather than the item itself.
• When you double-click a shortcut, the item opens. If you delete a shortcut, only the shortcut is removed, not the original item. You can identify shortcuts by the arrow on their icon.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
319
Selecting multiple icons• To move or delete a bunch of icons at once, you must first select all of them. Click an empty area of the desktop and drag the mouse. Surround the icons that you want to select with the rectangle that appears. Then release the mouse button. Now you can drag the icons as a group or delete them.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
320
The Recycle Bin• When you delete a file or folder, it doesn't actually get deleted right away—it goes to the Recycle Bin. That's a good thing, because if you ever change your mind and decide you need a deleted file, you can get it back.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
321
The Start menu• The Start menu is the main gateway to your computer's programs, folders, and settings. It's called a menu because it provides a list of choices, just as a restaurant menu does. And as "start" implies, it's often the place that you'll go to start or open things.
• Use the Start menu to do these common activities:
� Start programs
� Open commonly used folders
� Search for files, folders, and programs
� Adjust computer settings
� Get help with the Windows operating system
� Turn off the computer
� Log off from Windows or switch to a different user account
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
322
The taskbar• The taskbar is the long horizontal bar at the bottom of your screen. The taskbar is almost always visible. It has three main sections:
1. The Start button Picture of the Start button, which opens the Start menu.
2. The middle section, which shows you which programs and files you have open and allows you to quickly switch between them.
3. The notification area, which includes a clock and icons (small pictures) that communicate the status of certain programs and computer settings.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
323
The taskbar• Each program has its own button on the taskbar
• Click a taskbar button to switch to that window
• Minimizing Calculator leaves only its taskbar button visible
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
324
The taskbar• The notification area is at the far right of the taskbar
• The notification area displays a message after new hardware is installed
• Click the Show hidden icons button to display all icons in the notification area
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
325
Working with windows• Whenever you open a program, file, or folder, it appears on your screen in a box or frame called a window
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
326
Dialog boxes• A dialog box appears if you exit a program without saving your work.
• Unlike regular windows, most dialog boxes can't be maximized, minimized, or resized. They can, however, be moved.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
327
Working with files and folders• A file is an item that contains information—for example, text or images or music.
• On your computer, files are represented with icons; this makes it easy to recognize a type of file by looking at its icon. Here are some common file icons:
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
328
Working with files and folders• A folder is a container you can use to store files in.
• If you had thousands of paper files on your desk, it would be nearly impossible to find any particular file when you needed it. That's why people often store paper files in folders inside a filing cabinet.
• On your computer, folders work the same way. Here are some typical folder icons:
• Folders can also store other folders. A folder within a folder is usually called a subfolder. You can create any number of subfolders, and each can hold any number of files and additional subfolders.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
329
Understanding the parts of a window
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
330
Copying and moving files and folders• Occasionally, you might want to change where files are stored on your computer.
• Most people copy and move files using a method called drag and drop. Start by opening the folder that contains the file or folder you want to move. Then, open the folder where you want to move it to in a different window. Position the windows side by side on the desktop so that you can see the contents of both. Next, drag the file or folder from the first folder to the second folder. That's all there is to it.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
331
Creating and deleting files• The most common way to create new files is by using a program.
• Some programs create a file as soon as you open them. When you open WordPad, for example, it starts with a blank page. This represents an empty (and unsaved) file. Start typing, and when you are ready to save your work, click the Save button Picture of the Save button in WordPad. In the dialog box that appears, type a file name that will help you find the file again in the future, and then click Save.
• By default, most programs save files in common folders like My Documents and My Pictures, which makes it easy to find the files again next time.
• When you no longer need a file, you can remove it from your computer. To delete a file, open the folder or library that contains the file, and then select the file. Press Delete on your keyboard and then, in the Delete File dialog box, click Yes.
• When you delete a file, it's temporarily stored in the Recycle Bin. Think of the Recycle Bin as a safety net that allows you to recover files or folders that you might have accidentally deleted. Occasionally, you should empty the Recycle Bin to reclaim all of the hard disk space being used by your unwanted files. Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
332
Opening an existing file• To open a file, double-click it. The file will usually open in the program that you used to create or change it. For example, a text file will open in your word-processing program.
• That's not always the case, though. Double-clicking a picture file, for example, will usually open a picture viewer. To change the picture, you need to use a different program. Right-click the file, click Open with, and then click the name of the program that you want to use.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
333
File Extensions• File extensions are the part of the filename that is after the dot in Windows. For example, a text file like readme.txt has txt as its extension.
• Extensions Tell What Type of File
• The extension tells Windows how to deal with a certain file by identifying the type of file it is. By associating a certain extension with a default program to deal with that sort of file, you can open the program by double-clicking on the filename. The type of file is usually indicated by its icon as well.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
334
Common Extensions• There are hundreds of extensions, many of which are proprietary (e.g. specific to a particular program) and quite a few that are legacy (no longer in active use). Some of the more common ones are:
• .txt text file
• .doc Microsoft Word document
• .docx Microsoft Word open XML document — Word 2007 or later
• .xls Microsoft Excel spreadsheet
• .xlsx Microsoft Excel open XML spreadsheet — Excel 2007 or later
• .ppt Microsoft PowerPoint presentation document
• .pptx Microsoft PowerPoint open presentation document — PowerPoint 2007 or later
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
335
Common Extensions• .html Web page (Hypertext Markup Language) file
• .mp3 audio (music) file
• .pdf Adobe Portable Document Format file (Adobe Reader)
• .jpg JPEG image file (usually a photo)
• .iso Disc Image File used to create a CD or DVD
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
336
Dangerous Extensions• Some Windows extensions can indicate programs that can do harm to your computer. You should always be careful with files that have the following extensions, particularly if attached to an email message, because they can be used to install malicious or unwanted programs:
� .pif program information file
� .exe executable (program) file
� .bat batch file — can call other files including program or scripting files
� .scr scripting file — sometimes mistakenly called a screen saver file
• Most users should not see any of these sorts of files attached to emails. While any of these could be legitimate files it is more likely that its purpose is to infect your computer with a virus or other malicious program.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
337
Hidden By Default• Windows hides "known" extensions by default (Windows "knows" what the extension is — you may not).
• This was probably done to make it look less intimidating, but you should re-enable the display of these extensions (see Folder Options). Many file extensions are not safe to open unless provided by a trusted source.
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
338
File Structures
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
339
File Structures
• Knowledge of how an operating system stores and maintains data in a computer � Allows better comprehension of how a computer handles and manipulate files
� Allows the computer to run as efficiently as possible
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
340
What Does a File System Do?
• Responsibilities� Creating, manipulating, renaming, copying, and removing files to and from a storage device
� Organizing files into common storage units
� Called directories
� Keeping track of file and directory locations
� Assisting users
� Relate files and folders to the physical structure of the storage medium
• Operating systems use a file folder icon to represent a directory Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
341
What Does a File System Do?
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
342Files and directories in a file system are similar to documents and folders in a filing cabinet
What Does a File System Do?
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
343Folders and files in Windows
What Does a File System Do?
•Hard disk�Most common storage medium for a file system
� Physically organized into tracks and sectors
� Read/write heads move over specified areas of the hard disk to store (write) or retrieve (read) data
� Random access device
� Reads or writes data directly on the disk
� Makes use of the file system to organize files
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
344
File Systems and Operating Systems• File management system
� Dependent on the operating system
• FAT (File Allocation Table)� Used from MS-DOS to Windows ME
• NTFS (New Technology File System)� Default for Windows
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
345
Clusters
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
346Sectors are grouped into clusters on a hard disk
Partitions• Disks are broken into one or more partitions/volumes.
• Each partition can have its own file system method (UFS, FAT, NTFS, …).
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
347
FAT• Groups hard drive sectors into clusters (the smallest unit that can be allocated to construct a file)� Increases performance by organizing blocks of sectors contiguously
• Maintains a relationship between files and clusters� Clusters have two entries in the FAT
� Current cluster information
� Link to next cluster or special code indicating the last cluster
• Keeps track of writable clusters and bad clusters
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
348
FAT
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
349
FAT
•Hard drive organization� Partition boot sector
� Contains information on how to access volumes
�Main and backup FAT
� If error in reading the main FAT, backup copied to main to ensure stability
� Root directory
� Contains entries for every file and folder in the directory
� Data area
� Measured in clusters
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
350
FAT
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
351Typical FAT file system
Volume size V.S. Cluster sizeDrive Size Cluster Size Number of Sectors
--------------------------------------- -------------------- ---------------------------
512MB or less 512 bytes 1
513MB to 1024MB(1GB) 1024 bytes (1KB) 2
1025MB to 2048MB(2GB) 2048 bytes (2KB) 4
2049MB and larger 4096 bytes (4KB) 8
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
352
FAT16 Limitations• Entry to reference a cluster is 16 bit� Thus at most 216=65,536 clusters accessible.� Partitions are limited in size to 2~4 GB.� Too small for today’s hard disk capacity!
• For partition over 200 MB, performance degrades rapidly. � Wasted space in each cluster increases.
• Two copies of FAT…� still susceptible to a single point of failure!
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
353
FAT32Enhancements over FAT
•More efficient space usage � By smaller clusters.
� 32 bit entry
•More robust and flexible� root folder became an ordinary cluster chain, thus it can be located anywhere on the drive.
� back up copy of the file allocation table.
� less susceptible to a single point of failure. Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
354
Disadvantages of FAT• Performance slows down as more files are stored on the partition
• Lack of security� NTFS provides access rights to files and directories
• File integrity problems� Lost clusters
� Invalid files and directories
� Allocation errors
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
355
Advantages of FAT• Efficient use of disk space
� Does not have to use contiguous space for large files
• File names up to 255 characters (FAT32)
• Easy to recover deleted files upon deletion� System places E5h in the first position of filename
� File remains on drive
� Replace E5h with original first letter of the filename
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
356
NTFS
• MFT == Master File Table � Analogous to the FAT
• Design Objectives1) Fault-tolerance
� Built-in transaction logging feature.
2) Security
� Granular (per file/directory) security support.
3) Scalability
� Handling huge disks efficiently. Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
357
NTFS• Overcomes FAT system limitations
• “Journaling” file system
� Keeps track of transaction performed
� “Rolls back” transactions if errors found
• Uses a Master File Table (MFT)
� Stores data about all files and directories
� Similar to database table with records
• Uses clusters
• Reserves blocks of space to allow the MFT to grow
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
358
Advantages of NTFS
• File access is very fast and reliable
•MFT allows system recovery from problems without losing significant amounts of data
• Security is greatly increased over FAT
• File encryption with EFS (Encrypting File System)
• File compression reduces file size � Saves disk space
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
359
Disadvantages of NTFS
• Large overhead�Not recommended for volumes less than 4 GB
• Cannot access NTFS volumes from:�MS-DOS
�Windows 95
�Windows 98
� Linux
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
360
Comparing File Systems• Choosing correct file system
� Operating system dependent
� Rarely depends on hardware
• NTFS: Windows XP or Vista� Supports drive sizes up to 16 TB (1600 GB)
• FAT: Windows 9x� Older small hard drives, small removable devices
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
361
Comparing File Systems
Intr
od
uct
ion
to
Co
mp
ute
r S
cie
nce
(I1
10
0)
20
15
-20
16
362