1 / 52

Chapter 10: Operating Systems

Chapter 10: Operating Systems. An operating system is a set of programs through which a computer manages its resources. Its main functions are to:. Manage the computer hardware CPU performance & utilization Memory allocation & protection Input-output management Keyboard control

adriel
Download Presentation

Chapter 10: Operating Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 10: Operating Systems An operating system is a set of programs through which a computer manages its resources. Its main functions are to: • Manage the computer hardware • CPU performance & utilization • Memory allocation & protection • Input-output management • Keyboard control • Mouse device driver • Printer spooling • Display monitor Chapter 10 Operating Systems Page 110

  2. 2) Support application software Word processors Electronic spreadsheets Database management Computer graphics & games Chapter 10 Operating Systems Page 111

  3. 3) Establish a user interface Textual, with a command-line prompt Graphical, with windows, menus, and icons Chapter 10 Operating Systems Page 112

  4. Different Approaches to Processing RAM Process Process Process PCB PCB PCB CPU Batch Processing Non-interactive execution of one or more programs with distinct input and output sessions Time-Sharing Multiple programs executing “simultaneously” (via time slices) on a single computer (either many users on a server or one user “multitasking”) Interactive Processing Execution of a program with additional input from the user and output to the user during execution Multiprocessing Multiple CPUs available within the computer system, either across a network or within a single machine (e.g., a supercomputer) Chapter 10 Operating Systems Page 113

  5. Memory Management The operating system must coordinate the use of main memory for any active program on the computer. When the program is compiled, fake “virtual” addresses are used as placeholders for the memory addresses of data (i.e., variables) and instructions (i.e., functions, loops, and conditionals). When the program is loaded into RAM, the virtual “logical” addresses are mapped to actual “physical” addresses where the various parts of the program are really stored. Chapter 10 Operating Systems Page 114

  6. Paging Since multiple programs might be active simultaneously and since RAM has a limited capacity, large segments of one program’s memory might be relegated to a backup device to make room for another program’s memory needs. Backup Storage (Disk) RAM Program A’s Virtual Space In this example, when program B is activated, space in RAM is made available by first “paging out” part of program A... 4   6  1 1   4 4 2 5 2  7  1 3 1  1    1 3 4 2 1 1  2 2 3 1 3 6 3  Program B’s Virtual Space ...and then “paging in” program B. 7 3 5 1  1 4 2  4 6  4 2 2 2  3  3  3 Chapter 10 Operating Systems Page 115 3 3  8   5 2 4  1  

  7. CPU Management Every process executed by the CPU is managed by the operating system. New Process (In a file on the hard drive, it needs to be loaded into RAM) Conceptually, the operating system moves the process from state to state in its journey through CPU execution. Terminated Process (Finished executing, its memory must be marked “free”) OS “dispatches” process by allotting CPU time Ready Process (Loaded into RAM, it will run when allotted CPU time) Running Process (In RAM, with CPU processing its instructions) OS “admits” process by loading into RAM OS starts cleaning up after the process has completed OS “interrupts” process to give another process CPU time OS moves process to ready state when it’s ready to resume Waiting Process (Needs I/O or some event in memory, temporarily can’t run) OS moves process to waiting state when it starts idling

  8. CPU Scheduling When multiple processes are vying for the CPU’s attention, the operating system must schedule them. Common Scheduling Options: First-Come First-Served (FCFS) Disadvantage: Smaller jobs may have to wait an inordinate amount of time. Shortest Job First (SJF) Disadvantage: Large jobs must wait until everything else is finished before starting. Round Robin Disadvantage: Processes constantly interrupted when time slices expire.

  9. Resource Allocation Problems Waiting Producer Full Queue Consumer Producer Waiting Empty Queue Consumer Mutual Exclusion If two processes require access to the same nonshareable resource at the same time, then both cannot be accommodated. Example: Producer & Consumer When extreme cases occur (either there are no resources available to be consumed, or no room for more to be produced), a “semaphore” is set to signal that someone must wait. Deadlock If two processes are simultaneously blocking each other’s progress, then neither one may be able to proceed. One process copies from the flash to the DVD Chapter 10 Operating Systems Page 118 One process copies from the DVD to the flash

  10. Chapter 11: File Systems and Directories Data is stored on magnetic and optical disks in files, named collections which are, in turn, grouped together into directories. To distinguish the types of data being stored in different files, the names of files are suffixed with an identifying file extension. Chapter 11 File Systems and Directories Page 119

  11. File Access There are two major ways in which files are organized and accessed. Sequential Access The records in the file are organized as a list and are retrieved and processed one at a time from the beginning to the end of the file. Direct Access The records in the file are arranged so an individual record may be retrieved without examining other records in the file. Chapter 11 File Systems and Directories Page 120

  12. Sequential File Access With sequential access, records are retrieved by starting at the beginning of the file and extracting them in the order in which they exist within the file. An example of this is the common input file (cin) in C++, which uses the input operator (>>) to access the next available piece of keyboard-generated data. • Advantages • Easy to program • Allows simple file structures • Well suited to many common programming applications (pattern searches, small files, rarely processed files) • Disadvantage • Poor access performance Common Application: Text Files Chapter 11 File Systems and Directories Page 121

  13. Indexed Files To implement direct access in file organization, an indexed directory is often stored in memory. This directory is basically a table consisting of some aspect of each record (called a key) and the corresponding record’s location within the file. Chapter 11 File Systems and Directories Page 122

  14. Hashed Files To provide direct access to the records in a file without the overhead of an indexed directory, hashing is a viable alternative. With hashing, one of the record’s key fields is used to map the record to a particular section (or “bucket”) in the memory device. If the hashing function is strategically chosen, then the buckets will be relatively balanced and efficiency will be enhanced. Chapter 11 File Systems and Directories Page 123

  15. Directories To organize files within a computer system, hierarchical directories are usually implemented. This traditional approach to file organization is known as the “folder metaphor” since it is analogous to the organization of paper file folders. Chapter 11 File Systems and Directories Page 124

  16. Disk Scheduling Accessing secondary memory is one of the most time-consuming aspects of processing, so a primary goal is to ensure that such access is handled as efficiently as possible. The most common approach is to have the read-write heads move towards the shaft, reading all requested sectors of all requested tracks as each successive cylinder is reached. Once the shaft is reached, the read-write heads move away from the shaft, reading all requested sector/track combinations until the outer platter edge is reached, whereupon the entire process is repeated. Chapter 11 File Systems and Directories Page 125

  17. Chapter 12: Information Systems Information systems are software applications that facilitate the organization and analysis of data. Example: Spreadsheet software allows users to place raw data in tables and then utilize formulas and basic graphical mechanisms to generate calculations and illustrations from it. Chapter 12 Information Systems Page 126

  18. Database Structures Payroll Dept. Maint-enance Dept. Rental Dept. Sales Dept. Market-ing Dept. Purch-asing Dept. Sales Dept. Rental Dept. Purch-asing Dept. Advertise- ment Files Store Upkeep Files Store Personnel Files Video Sales Files Video Rental Files Video Purchase Files Integrated Database Payroll Dept. Market-ing Dept. Maint-enance Dept. An alternative to a distributed information system based upon files is a centralized system based upon the concept of databases. File-Oriented System Database-Oriented System Chapter 12 Information Systems Page 127

  19. A Modular View of a Database System The DBMS uses schema and subschema to ensure data security. A schema describes the way the entire database is organized. A subschema describes the organization of the portion of the database that is accessible to a particular type of user. Chapter 12 Information Systems Page 128

  20. The Relational Database Model The simplest conceptual arrangement of a database uses a table of rows (called tuples) and columns (called attributes). The major advantage of this model is its logical conceptualization. The major disadvantage is the substantial amount of software and hardware overhead required to maintain and access the table. Chapter 12 Information Systems Page 129

  21. Relational Operator SELECT The SELECT operation determines which tuples have particular attributes. Apply SELECT with Price < 10.00 Chapter 12 Information Systems Page 130

  22. Relational Operator PROJECT The PROJECT operation limits the scope of the database to specific attributes. Apply PROJECT with Code & Price Chapter 12 Information Systems Page 131

  23. Relational Operator JOIN The JOIN operation combines multiple tables that have common attributes. Apply JOIN with CUSTOMER.RepNo = SALESREP.RepID Chapter 12 Information Systems Page 132

  24. Concurrency Control A potential problem with database systems that allow multiple access points is the loss of data integrity. At ATM #1: Deposit $400 At ATM #2: Withdraw $200 Get Balance... $500 Get Balance... $500 Add $400 to Balance... $900 Subtract $200 from Balance... $300 Store new Balance... $900 Store new Balance... $300 Either balance that’s stored would be incorrect, since the correct balance is $700! Chapter 12 Information Systems Page 133

  25. Databases and Privacy The proliferation of information on database systems poses a potential threat to the privacy of people about whom the data refers. Example: Medical Databases • Advantages: • Reduction of paperwork • Fewer false insurance claims • Facilitates disease tracking • Immediate access in emergency • Cost-effective ID of treatment • Safer than paper records • Disadvantages: • Employer access might cost jobs • “High risk” insurance increases • Unsolicited advertisements • Fear inhibits candid disclosure • Inaccuracies are spread easily • Dr./patient confidentiality loss Chapter 12 Information Systems Page 134

  26. Cryptography Networks are set up to send messages right past stations that aren’t authorized to read them, but what’s to prevent such unauthorized viewing? Message Message The most common solution to this problem is encryption, where the message is coded in such a way that only the receiving station can decode it. Chapter 12 Information Systems Page 135

  27. Public-Key Encryption I have affixed to me the dirt and dust of countless ages! Chuck mdbriugndlwg Linusmamnsgfyddkd Lucy qhgwdnchsgsh Patty ahwbsgcydhzx xsjb2dhdkWb$xzduYdm!dj5slLssghd8nd&hsnqabi?dsjsg% 1. Create Message 2. Look Up Recipient’s Public Key 3. Encrypt Message With Recipient’s Public Key 4. Transmit Encrypted Message I have affixed to me the dirt and dust of countless ages! xsjb2dhdkWb$xzduYdm!dj5slLssghd8nd&hsnqabi?dsjsg% 5. Decrypt Message With Recipient’s Private Key Chapter 12 Information Systems Page 136

  28. Key-Based Authentication I’m going to recruit that funny-looking kid who plays shortstop on Chuck’s team! Ma3ndhvyr#bcjaqwpfQkguiorkfohskxi8vce%fpgkjfhikfvdamxxyemfideychssfhsgdhahdm$dlglyn7buchso 1. Create Message 2. Encrypt Message With Sender’s Private Key 3. Transmit Encrypted Message I’m going to recruit that funny-looking kid who plays shortstop on Chuck’s team! Ma3ndhvyr#bcjaqwpfQkguiorkfohskxi8vce%fpgkjfhikfvdamxxyemfideychssfhsgdhahdm$dlglyn7buchso 4. Decrypt Message With Sender’s Public Key When a message is received, how can you be sure who it came from? Chapter 12 Information Systems Page 137

  29. Chapter 13: Artificial Intelligence Computations that make it possible for a machine to perceive, reason, and act in a manner consistent with human behavior form the field known as artificial intelligence. The Turing Test A human questioner inputs questions and guesses which respondent is human, based on the answers given. If the questioner cannot tell which respondent is human, the software passes the test. Chapter 13 Artificial Intelligence Page 138

  30. Computer Reasoning To simulate logical reasoning, heuristic functions are often used. A heuristic is an artificial measure of how close the computer’s current status is to its problem-solving goal. 1 - - - - 2-1=1 3-1=2 2-1=1 3-1=2 - 2-1=1 2-1=1 2-1=1 - 3-2=1 2-2=0 3-2=1 - 2-2=0 2-2=0 3-2=1 - 2-1=1 3-1=2 3-1=2 Chapter 13 Artificial Intelligence Page 139 In the tic-tac-toe example above, when the computer is ready to make an X-move, it uses the heuristic max{F(config), where config can be the result of any O-move}.

  31. Expert Systems By programming a computer with the assistance of experts in a particular field, an expert system can be developed to perform very specialized tasks. Users in need of expert assistance complete on-line questionnaires and the expert system analyzes their responses and assigns probabilities to various diagnoses. Chapter 13 Artificial Intelligence Page 140

  32. Genetic Algorithms When a problem has no definitive algorithmic solution, it’s possible that a technique can be developed by which the solution can evolve. This type of solution, known as a genetic algorithm, involves the generation of numerous possible solutions called a population. Each member of the population has a fitness score based on the goal of the problem. Subsequent generations are then created by blending members of the population and subjecting some to mutations. The goal is to “breed” solutions, over multiple generations, that better solve the problem. For example, in the example at left, the problem of producing a flywheel composed of a variety of ceramic, polymer, and fiber materials is addressed. An optimal balance of materials is desired so the flywheel can spin faster (thus producing greater kinetic energy), but not so fast that the resulting shear forces will rip the flywheel apart. Chapter 13 Artificial Intelligence Page 141

  33. Neural Networks To simulate learning, certain multiprocessor systems, called neural networks, have been built to “learn” to recognize particular patterns as correct or incorrect, based upon a trial-and-error process. In the example below, a neural network is used to teach a computerized system how to back a truck up to a loading dock. The physical characteristics of the truck are programmed, with the relationship between the steering wheel, the tires, the cab, and the trailer formally calculated. Starting at some initial position, the truck is backed up one meter at a time, with programmed steering; the error in the result is measured and factored into the next attempt, until the error is zero. Chapter 13 Artificial Intelligence Page 142

  34. Natural Language Processing Written Comprehension: How can a computer be programmed to grasp the syntax and semantics of a natural language? John saw the boy in the park with the telescope. Question: Whose telescope is it? Answer: John’s John saw the boy in the park with the puppy. Question: Whose puppy is it? Answer: The boy’s John saw the boy in the park with the statue. Chapter 13 Artificial Intelligence Page 143 Question: Whose statue is it? Answer: The park’s

  35. Speech Recognition 0011010101000010111110101001001101010100101011110010101101010011010101010101010101010101001 1. The PC sound card converts analog sound waves spoken into a microphone into a digital format. “K” “AH” “M” “P” “Y” “OO” “T” 0011010101000 “K” 0101111101010 “AH” 0100110101010 “M” 0101011110010 “P” 1011010100110 “Y” 1010101010101 “OO” 0101010101001 “T” CALM COMMA COMPARE COMPETE COMPLETE COMPUTE 3. A software language model compares the phonemes to words in its dictionary. 2. A software acoustical model breaks the word into phonemes. COMPUTE Chapter 13 Artificial Intelligence Page 144 4. Once the software decides on the most likely candidate, it displays that word.

  36. Robotics Robots are programmable devices capable of manipulating objects and performing tasks much like humans are able to do. One of the more difficult problems when programming a robot is determining when it is about to collide with something, when it has collided with something, and what to do in response to a collision. Collision Avoidance Use scanners to determine the robot’s proximity to other objects, redirecting the robot when a collision is imminent. Collision Detection Use sensors at strategically located places on the robot to determine if a collision occurs. Collision Reaction Go around? Climb over? Bounce back? Run away? Drop dead? Chapter 13 Artificial Intelligence Page 145

  37. Robot Challenges Other common human actions that are difficult to program include propelled locomotion and manual manipulation. Walking Gait How can a robot be programmed to propel itself forward on “legs” and still maintain its balance? Grasping How can a robot be programmed to grasp part of a stack of objects, without toppling the rest of the stack? Chapter 13 Artificial Intelligence Page 146

  38. AI in Games Non-player characters in games need to appear intelligent, even though they are controlled by the game program instead of by a game player. Dead Reckoning By having a game-driven predator character react to the anticipated position of its player-driven prey (using the prey’s current position and velocity), a chase can appear more realistic. Flocking By providing a group of characters with simple goals and behaviors, a “mob mentality” can be implemented with a minimum of code. Chapter 13 Artificial Intelligence Page 147

  39. Chapter 14: Simulation, Graphics, and Other Applications In order to gain insight into complex systems, scientists often build computer models to simulate their performance. Continuous Dynamic Simulation Elaborate equations representing the different aspects of the model are periodically solved to generate a sequence of snapshots of its performance (e.g., flight simulators). Discrete Event Simulation The system is represented as a chronological sequence of events, each of which subtly impacts the overall state of the system (e.g., network modeling). Chapter 14 Simulation, Graphics, and Other Applications Page 148

  40. Computer Graphics Recent advances in processor power, display technology, memory capacity, and rendering algorithms have made it possible to produce dazzling images using relatively inexpensive computers. Chapter 14 Simulation, Graphics, and Other Applications Page 149

  41. Drawing Lines and Circles Pixel-based display technologies cause inherent problems when displaying circles or non-vertical/non-horizontal lines. Chapter 14 Simulation, Graphics, and Other Applications Page 150

  42. Antialiasing Complex scenes lose their integrity when using single-colored pixels. Jagged Profiles Loss Of Detail Disintegrating Textures A common way to address this problem is with antialiasing algorithms, which combine the colors affecting a particular pixel into a “blended” color that will minimize these negative effects. Chapter 14 Simulation, Graphics, and Other Applications Page 151

  43. 3D Shading The easiest way to store information about most 3D objects is as a set of polygons. Unfortunately, smooth objects aren’t necessarily polyhedral, so the resulting image looks bad. The common solution to this problem is to use a shading algorithm, which progressively blends the shading of adjacent polygons to smooth out the reflection of the virtual light across the surface. Chapter 14 Simulation, Graphics, and Other Applications Page 152

  44. Lighting Effects In order to accurately model lighting effects, the shading algorithm must take into account the position of the graphical scene’s virtual light source and the rendered objects’ locations with respect to it. More sophisticated lighting models take into account radiosity, the fact that light reflects off the surface of some objects and, in turn, illuminates other objects. Chapter 14 Simulation, Graphics, and Other Applications Page 153

  45. Ray Tracing Rays are cast from the viewer’s position through each pixel; the first object that’s hit is the one that’s rendered in that pixel. To calculate reflections, the ray is bounced from the hit object (if it’s shiny) at the opposite angle at which it hit the object; if another object is hit, then the second object will be reflected on the surface of the first object. To calculate shadows, the ray is bounced from the hit object to the scene’s light source, if another object is hit on the way to the light, then the original object is in shadow. Chapter 14 Simulation, Graphics, and Other Applications Page 154

  46. Texture Mapping To give a greater sense of realism to 3D graphical objects, texture mapping provides an inexpensive means of placing 2D “wallpaper” around the objects. Bump mapping can make the results even more visually striking, by adding a displacement factor across the surface of the objects, giving the illusion of 3D texture in the resulting lighting effects. Chapter 14 Simulation, Graphics, and Other Applications Page 155

  47. Character Animation By strategically manipulating specific vertices comprising an animated model, a graphics artist can make the model behave in a lifelike manner. Chapter 14 Simulation, Graphics, and Other Applications Page 156

  48. Embedded Systems Special-purpose computer systems are often designed to perform a specific list of dedicated tasks. • Embedded systems: • are often built into the devices they control, rather than being separate devices. • frequently have real-time performance constraints. • often have low performance requirements, allowing cheaper hardware to be used. • use software called firmware, usually stored in ROM or flash memory. Chapter 14 Simulation, Graphics, and Other Applications Page 157

  49. Electronic Commerce As networking capabilities have become ubiquitous, the ability to conduct financial business electronically has soared. Chapter 14 Simulation, Graphics, and Other Applications Page 158

  50. Computer Security A computer virus piggybacks on another file to “infect” a system. When a user runs an infected program, the computer starts by copying the program from the disk, where it is stored and inactive, into RAM, where it can be executed. The viral code begins running first, while the infected program is still quiescent. The virus copies itself in a part of RAM separate from the program so that it can continue its work even after the user starts running other software. Its initial work done, the virus passes control back to the infected program. When the user runs a different program, the dormant virus begins running again. It inserts a copy of itself into the previously uninfected software so that the cycle of virulence can repeat. Chapter 14 Simulation, Graphics, and Other Applications Page 159

More Related