1、APS审核操作系统操作系统Operating SystemWhat is an Operating System?A program that acts as an intermediary between a user of a computer and the computer hardwareOperating system goals:Execute user programs and make solving user problems easierMake the computer system convenient to useUse the computer hardware
2、in an efficient mannerComputer System StructureComputer system can be divided into four componentsHardware provides basic computing resourcesCPU, memory, I/O devicesOperating systemControls and coordinates use of hardware among various applications and usersApplication programs define the ways in wh
3、ich the system resources are used to solve the computing problems of the usersWord processors, compilers, web browsers, database systems, video gamesUsersPeople, machines, other computersOperating System DefinitionOS is a resource allocatorManages all resourcesDecides between conflicting requests fo
4、r efficient and fair resource useOS is a control programControls execution of programs to prevent errors and improper use of the computerNo universally accepted definition“The one program running at all times on the computer” is the kernel. Everything else is either a system program (ships with the
5、operating system) or an application programComputer System OrganizationComputer-System ArchitectureMost systems use a single general-purpose processor (PDAs through mainframes)Most systems have special-purpose processors as wellMultiprocessors systems growing in use and importanceAlso known as paral
6、lel systems, tightly-coupled systemsAdvantages include1.Increased throughput2.Economy of scale3.Increased reliability graceful degradation or fault toleranceTwo types1.Asymmetric Multiprocessing2.Symmetric MultiprocessingOperating-System OperationsInterrupt driven by hardwareSoftware error or reques
7、t creates exception or trapDivision by zero, request for operating system serviceOther process problems include infinite loop, processes modifying each other or the operating systemDual-mode operation allows OS to protect itself and other system componentsUser mode and kernel mode Mode bit provided
8、by hardwareProvides ability to distinguish when system is running user code or kernel codeSome instructions designated as privileged, only executable in kernel modeSystem call changes mode to kernel, return from call resets it to userProcess ManagementA process is a program in execution. It is a uni
9、t of work within the system. Program is a passive entity, process is an active entity.Process needs resources to accomplish its taskCPU, memory, I/O, filesInitialization dataProcess termination requires reclaim of any reusable resourcesSingle-threaded process has one program counter specifying locat
10、ion of next instruction to executeProcess executes instructions sequentially, one at a time, until completionMulti-threaded process has one program counter per threadTypically system has many processes, some user, some operating system running concurrently on one or more CPUsConcurrency by multiplex
11、ing the CPUs among the processes / threadsProcess Management ActivitiesThe operating system is responsible for the following activities in connection with process management:Creating and deleting both user and system processesSuspending and resuming processesProviding mechanisms for process synchron
12、izationProviding mechanisms for process communicationProviding mechanisms for deadlock handlingMemory ManagementAll data in memory before and after processingAll instructions in memory in order to executeMemory management determines what is in memory whenOptimizing CPU utilization and computer respo
13、nse to usersMemory management activitiesKeeping track of which parts of memory are currently being used and by whomDeciding which processes (or parts thereof) and data to move into and out of memoryAllocating and deallocating memory space as neededStorage ManagementOS provides uniform, logical view
14、of information storageAbstracts physical properties to logical storage unit - fileEach medium is controlled by device (i.e., disk drive, tape drive)Varying properties include access speed, capacity, data-transfer rate, access method (sequential or random)File-System managementFiles usually organized
15、 into directoriesAccess control on most systems to determine who can access whatOS activities includeCreating and deleting files and directoriesPrimitives to manipulate files and dirsMapping files onto secondary storageBackup files onto stable (non-volatile) storage mediaMass-Storage ManagementUsual
16、ly disks used to store data that does not fit in main memory or data that must be kept for a “long” period of timeProper management is of central importanceEntire speed of computer operation hinges on disk subsystem and its algorithmsOS activitiesFree-space managementStorage allocationDisk schedulin
17、gSome storage need not be fastTertiary storage includes optical storage, magnetic tapeStill must be managedVaries between WORM (write-once, read-many-times) and RW (read-write)I/O SubsystemOne purpose of OS is to hide peculiarities of hardware devices from the userI/O subsystem responsible forMemory
18、 management of I/O including buffering (storing data temporarily while it is being transferred),caching (storing parts of data in faster storage for performance),spooling (the overlapping of output of one job with input of other jobs)General device-driver interfaceDrivers for specific hardware devic
19、esA View of Operating System ServicesOne set of operating-system services provides functions that are helpful to the user:User interface - Almost all operating systems have a user interface (UI)Varies between Command-Line (CLI), Graphics User Interface (GUI), BatchProgram execution - The system must
20、 be able to load a program into memory and to run that program, end execution, either normally or abnormally (indicating error)I/O operations - A running program may require I/O, which may involve a file or an I/O device File-system manipulation - The file system is of particular interest. Programs
21、need to read and write files and directories, create and delete them, search them, list file Information, permission management.Communications Processes may exchange information, on the same computer or between computers over a networkCommunications may be via shared memory or through message passin
22、g (packets moved by the OS)Error detection OS needs to be constantly aware of possible errorsMay occur in the CPU and memory hardware, in I/O devices, in user programFor each type of error, OS should take the appropriate action to ensure correct and consistent computingDebugging facilities can great
23、ly enhance the users and programmers abilities to efficiently use the systemAnother set of OS functions exists for ensuring the efficient operation of the system itself via resource sharingResource allocation - When multiple users or multiple jobs running concurrently, resources must be allocated to
24、 each of themMany types of resources - Some (such as CPU cycles, main memory, and file storage) may have special allocation code, others (such as I/O devices) may have general request and release code Accounting - To keep track of which users use how much and what kinds of computer resourcesProtecti
25、on and security - The owners of information stored in a multiuser or networked computer system may want to control use of that information, concurrent processes should not interfere with each otherProtection involves ensuring that all access to system resources is controlledSecurity of the system fr
26、om outsiders requires user authentication, extends to defending external I/O devices from invalid access attemptsIf a system is to be protected and secure, precautions must be instituted throughout it. A chain is only as strong as its weakest link.Command Line Interface (CLI) or command interpreter
27、allows direct command entrySometimes implemented in kernel, sometimes by systems programSometimes multiple flavors implemented shellsPrimarily fetches a command from user and executes it Sometimes commands built-in, sometimes just names of programs If the latter, adding new features doesnt require s
28、hell modificationGUI User-friendly desktop metaphor interfaceUsually mouse, keyboard, and monitorIcons represent files, programs, actions, etcVarious mouse buttons over objects in the interface cause various actions (provide information, options, execute function, open directory (known as a folder)I
29、nvented at Xerox PARCMany systems now include both CLI and GUI interfacesMicrosoft Windows is GUI with CLI “command” shellApple Mac OS X as “Aqua” GUI interface with UNIX kernel underneath and shells availableSolaris is CLI with optional GUI interfaces (Java Desktop, KDE)System CallsProgramming inte
30、rface to the services provided by the OSTypically written in a high-level language (C or C+)Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call useThree most common APIs are Win32 API for Windows, POSIX API for POSIX-based systems (includin
31、g virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM)Types of System CallsProcess controlFile managementDevice managementInformation maintenanceCommunicationsProtectionVirtual MachinesA virtual machine takes the layered approach to its logical conclu
32、sion. It treats hardware and the operating system kernel as though they were all hardwareA virtual machine provides an interface identical to the underlying bare hardwareThe operating system host creates the illusion that a process has its own processor and (virtual memory)Each guest provided with a (virtual) copy of underly
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1