* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Batching processing
Library (computing) wikipedia , lookup
Security-focused operating system wikipedia , lookup
Copland (operating system) wikipedia , lookup
Plan 9 from Bell Labs wikipedia , lookup
Spring (operating system) wikipedia , lookup
Distributed operating system wikipedia , lookup
Burroughs MCP wikipedia , lookup
Chapter 3 Operating Systems Chapter 3 Operating Systems 3.1 The Evolution of Operating Systems 3.2 Operating System Architecture 3.3 Coordinating the Machine’s Activities 3.4 Handling Competition Among Processes 3.5 Security 2 Some functions of an operating system Control and Oversee operation of computer Store and retrieve files Schedule programs for execution Execute programs Ex:Microsoft Linux(By Linus Torvalds)Open sourcce 3 Evolution of shared computing Single-Processor Systems: Program execution of earlier computers requires significant preparation of equipments. Mounting, placing the punched cards, setting the switches, and so on. Each program execution is referred to as a job, an isolated activity. The next user only gains the full control of the computer after the completion of the current user. [sequentially] Batching processing executes a batch of collected jobs pending in the job queue(first-in, first-out) (FIFO) without further interaction with users. 4 Evolution of shared computing Single-Processor Systems: Interactive processing carries on a dialogue with the user. --It involves real-time processing for the machine to interact with its environment. --Reservation systems, word processing, computer games. To serve more than one user or job at a time, time-sharing technique divides time into time intervals or time slices, each designated to one task. --Time-sharing used in single-user systems is usually called multitasking. --Tradeoffs: The overhead to rapidly shuffle the jobs to gain the illusion of concurrent execution of several jobs. The time wasted to await the completion of peripheral devices or user’s inputs. Multiprocessor Systems: With networks like the Internet, many small5 machines can flexibly collaborate for computing, in contrast to an Evolution of shared computing Batch processing Job queue Time-sharing Multi-tasking: multiple tasks for a single user Interactive processing Real-time processing Scheduling multiprocessor machines 6 Figure 3.1 Batch processing 7 Figure 3.2 Interactive processing 8 Types of software Application software perform specific tasks for users spreadsheets, database systems, word processing systems, program development software, games, and so forth. System software: systems Operating system software Utility software the OS for simplicity. perform tasks needed by all computer abstracts the underlying hardware for the rest of performs fundamental activities, yet not included in Disk formatting, file copying, dial-up, compression, etc. 9 Figure 3.3 Software classification 10 Components of an operating system Shell: portion that communicates with users Graphical user interface (GUI) pictorially represents the objects on the screen, and accept the commands like mouse-clicking for execution. Textual shells(Borne shell, Korn shell, C shell, TC shell, MS-DOS) is light weighted only accepting the commands issued by a keyboard. Window manager is the component to govern the screen layout of GUI 11 Components of an operating system Kernel: contains components performing basic required functions File manager--coordinates the use of mass storage facilities.It keeps records of all the files: location (directory, folder, sub-directory, path), access permission and history (file descriptor), free available space, etc. Device drivers--are installed into the kernel to drive the corresponding peripheral devices using encapsulated activation steps specified for each device. Memory manager Scheduler and dispatcher 12 Components of an operating system Scheduler--According to some priorities or concerns, it determines which activities should be considered for execution. Dispatcher--It administrates the allocation of time slices to the activitiesbeing executed. 13 Figure 3.4 The shell as an interface between users and the operating system 14 File Manager Directory or folder: user-created group or bundle of files Path: position of a file in directory hierarchy File descriptor: information needed to access an open file 15 Memory manager Coordinate the machine’s use of main memory Total main memory required exceeds available(I.e., 512MB is requires but only 256MB available), it creates the illusion of additional memory space by rotating back and forth of program and data between main memory and mass storage 16 Memory manager Page: divide the required space into units called page (a few kilobytes) and store the content of the page in mass storage Virtual memory: illusionary memory space Created by shuffling units of data, called pages, between actual main memory space and mass storage 17 Getting it started (bootstrapping) Bootstrap: program in read only memory (ROM) Run by the CPU when power is turned on Transfers operating system from mass storage to main memory Executes jump to operating system 18 Figure 3.5 The booting process 19 BIOS(Basic Input/output System) In addition to bootstrap, read only memory (ROM) contains a set of routines for fundamental input/output activities Receive information from keyboard, display message on screen 20 Processes Program = a static set of directions --A program can be run multiple times, each instance/activity called a process. Process = the activity of executing a program --Each process has its own process state, recording the current status of the activity. Process state = current status of the activity Snapshot of relevant parts of the machine state Program counter, other registers, associated main memory 21 Process administration Scheduler Keeps state of all processes in an process table(in main memory) It contains—assigned memory area, priority and ready/waiting Ready if its progress can continue, or waiting if it is awaiting some external events to occur, and so on Priority Non-scheduling information: memory pages, etc. 22 Process administration (continued) Dispatcher Gives one time slice or quantum to a process that is ready Executes a process switch (or context switch) when the running process’s time slice is over A timer circuit counts down the quantum and generates an interrupt at the end. Such process switch involves updating the snapshot of the current process, restoring the snapshot of the next process, and then starting its execution. A program, called interrupt handler, is run for scheduler to update the process table, select the next process, …Early termination of quantum is also possible. Interrupt indicates that time slice is over Interrupt handler: part of dispatcher 23 Figure 3.6 Time-sharing between process A and process B 24 Handling competition for a resource System resources are shared among processes. --Some non-shareable resources like printers should not be simultaneously written by more than one process. Using a flag with the status of set(allocated) and clear(available), there seems to be only one process allowed to write to the very resource. OS checks the flag and to decide set or clear(note:check and set may require several machine cycle to finish) Due to process switch, two processes may just be aware of the clear flag right before being preempted. During the following quantum, they will proceed to 25 Handling competition for a resource Remedies: testing and setting the flag must be completed w/o interruption. (atomic) Semaphore = a control flag telling if resource is in use Critical region = sequence of instructions that should be executed by only one process at a time Test and set must be done together for proper function Usually protected by a semaphore Mutual exclusion = requirement for proper implementation of a critical region 26 Deadlock Two processes block each other from continuing Conditions that lead to deadlock 1. Competition for non-sharable resources 2. At least two resources are needed by both processes The resources are requested on a partial basis: having some, while requesting more. 3. An allocated resource can not be forcibly retrieved 27 Deadlock Deadlock ⇔cyclic wait-for graphs in the process table. The super-users may kill some processes for the rest to be finished. Deadlock avoidance schemes try to alter the first two conditions. To avoid the 2nd condition, each process is required to request all its resources at a time. To prevent the 1st condition, non-shareable resources are converted into sharable ones. 28 Figure 3.7 A deadlock resulting from competition for nonshareable railroad intersections 29 Spooling Postpone requested operation until a later time Makes a non-shareable resource appear shareable Technique of deadlock avoidance Printer spooling may be used for processes to write to their own designated disk space, instead of directly to the printer.Then, OS sends these printouts to the printer in series. Multiple read accesses to a file finely coexist, but conflict with any other write access. 30 Security from outside attacks Most common protection: require user name and password Problem: password stealing Problem: automated password guessers Counter measures: Always tell user when he/she last logged in Report repeated bad guesses Log the guesser into a captive account to spy on the guesser 31 Security from attacks from within Operating system prevents illegal access to resources Different memory for different processes Privileged instructions only allowed in kernel All file access passes through the kernel Other devices can only be accessed through the kernel 32