Презентация на тему: " 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 Software An operating system performs a vital role in –Enabling users to interact with a computer system. –Taking the specific responsibilities 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 Layers of Software The BIOS: Life at the Bottom Process Control 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. –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 –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 User-Written Scripts User Interface Application Run-time Library Application Program Interface Operating System Kernel Device Drivers BIOS Hardware Top Bottom
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 –when 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 –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 –e.g., 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 –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 applications 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 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/Vista –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.
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.
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. The initial message the BIOS displays will tell you what keys to press., such as F2 or ALT+CTRL+ESC 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 –CIH
Where does a computer store its basic hardware settings?
Process Control Keeps track of all the processes( ) running Process is an instance of a running program Process can be in 3 states: –Running –Running –Runnable –Runnable –Blocked –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. Uses a real-time clock that can generate 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 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.1 Interrupt Handling Interrupts Interrupt Priority and Nested Interrupts Traps and Faults
Interrupts 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 –Processors 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. –Processors 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.
keyboard interrupt handler –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. –The keyboard interrupt handler restores the contents of the saved registers. –Transfers control back to the previous task it was executing. –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 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 ( ) Trap ( ) A trap is an event similar to an interrupt, –Triggered( ) by the execution of processor instructions –Triggered( ) by the execution of processor instructions –An example is a division-by-zero operation –Interrupt being triggered by an external signal, 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 Fault Occurs when: –The hardware is asked to perform a task that is not possible for the hardware devices –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 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. –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 Driver operate in a particular fashion include operations to customize its functions for a specific user or system requirement 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. –Utilities exist for backup, restoring, or before changes are made to the hardware.
Plug and Play 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 –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. –or a folder on the hard disk where you previously downloaded the driver from the Internet.
Plug and Play Plug and Play if Windows does not recognize a newly added device Use Add New Hardware utility. Use Add New Hardware utility. If an appropriate driver is not found –Windows will be unable to use the device.
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 –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. –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. –since as soon as you load the second one, it will overwrite the first.
Relocation 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 (continued) Advantages : –Simple to implement –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 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 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 programs address space is kept on the disk. –the rest of the programs 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 processors physical memory. Why? Virtual address space( ) can be larger than processors 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.
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 – –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
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 create, 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. –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 tasks window display. User can change the arrangement of window by resizing, minimizing, or maximizing the window.
3.4 File Systems File Organization File Allocation Table and NT File System
3.4.1 File Organization FilesFoldersDrivesPathsShortcuts File Names and Types
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. File extensions indicate the category to which the file belongs, preceded with a dot.
File Systems 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. 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 adirectory for each disk. Operating system maintains list of all the files in adirectory 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. Folder Sub folder Root Folder Fil e
3.4.2 File Allocation Table and NT File System Clusters and File Allocation Tables FAT16FAT32 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 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( ). 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 for every cluster on the disk. –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. –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 Recoverability –maintains the consistency of data using journaling ( ) –maintains the consistency of data using journaling ( ) keeping a log of each I/O operation that modifies a system file within a logical drive. 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. 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 NTFSFAT32FAT16 Operating System Windows XP Windows 2000 Windows NT Windows XP Windows 2000 Windows 98 Windows ME Windows 95 OEM Service Release 2 (OSR2) All versions of Microsoft Windows DOS Max Volume Size2 TB32 GB2 GB Files per Volume~ 4 billion~ 4 million~ 64,000 Max File Size2 TB4 GB2 GB