System Software and Virtual Machines PDF
Document Details
Uploaded by ImpressiveLake
null
null
null
Tags
Summary
This document provides an introduction to system software and virtual machines. It covers topics such as system software categories, comparing virtual machines with naked machines, benefits of assembly language, translating assembly language, and operating systems. The content is intended for an undergraduate computer science course, and it is a set of lecture notes.
Full Transcript
Chapter 6 An Introduction to System Software and Virtual Machines INVITATION TO Computer Science 1 Objectives After studying this chapter, chapter students will be able to: Describe the main...
Chapter 6 An Introduction to System Software and Virtual Machines INVITATION TO Computer Science 1 Objectives After studying this chapter, chapter students will be able to: Describe the main categories of system tasks Compare p the virtual machine created for the user by y system software with the naked machine Explain the benefits of writing system software in assembly language, language rather than machine language Read and write short assembly language programs Describe how an assembler translates assembly language programs into machine instructions Invitation to Computer Science, 6th Edition 2 Objectives (continued) After studying this chapter, chapter students will be able to: List five key tasks of an operating system, and explain what each is and why it is critical to modern systems Describe the different generations of operating systems, what the features of each generation were, and how each generation solved a drawback of the previous generation Invitation to Computer Science, 6th Edition 3 Introduction A naked machine has no tools or programs to help the user – Write instructions in binaryy – Write data in binary – Load instructions into memory one cell at a time – Initiate program run Too difficult for humans to do We must build an interface to hide the details and make the computer easier to build Invitation to Computer Science, 6th Edition 4 System Software System software is a collection of programs to – manage resources of the computer – serve as intermediaryy between user and hardware System software creates a virtual machine (or virtual environment) that user sees Invitation to Computer Science, 6th Edition 5 System Software (continued) Operating system: central system software – Communicates with users – Starts up p other system y software and applications pp as needed Graphical user interface (GUI), often pronounced gooey – visual interface to operating system (or other system software/applications) I/O systems: communicate with various devices Invitation to Computer Science, 6th Edition 6 System Software (continued) Language services: support high level languages Memory managers: allocate memory to programs Information managers: organize mass storage Scheduler: manage programs waiting to run Utiliti Utilities: ttools, l iincluding l di program lib i libraries Invitation to Computer Science, 6th Edition 7 System Software (continued) Naked machine: Virtual machine: 1. Write program in binary 1. Write program using text 2. Load instructions one-by- one by editor in high-level g one into memory language 3. Insert start into memory 2. Save program to folder address dd 0 andd push h ““go”” 3 Use 3. U ttranslator l t tto convertt button to binary 4 Read results from 4. 4 Use scheduler to load 4. memory one-by-one, in and run binary 5. Use I/O system to print results Invitation to Computer Science, 6th Edition 8 Assemblers and Assembly Language Assembly language – Instructions map one-to-one to machine language – Symbolic y op p codes ((not binary) y) – Symbolic addresses for instructions and data – Pseudo-ops for data generation and more (data in human-friendly terms) A Assembly bl = a low-level l l l programming i language l Java, C, Python = high-level programming languages Invitation to Computer Science, 6th Edition 9 Invitation to Computer Science, 6th Edition 10 Assemblers and Assembly Language (continued) Assembly language process: Source program, in assembly language Translated by the assembler to Object program, in machine language Loader places in memory Hardware runs Invitation to Computer Science, 6th Edition 11 Invitation to Computer Science, 6th Edition 12 Assemblers and Assembly Language (continued) Example Assembly language: NEXTSTEP: LOAD X -- Put X into reg. R label: opcode address field -- comment Label is optional name for this instruction’s instruction s location Op code mnemonic and address field translate to machine language Comments are ignored by assembler, just for human use Invitation to Computer Science, 6th Edition 13 Invitation to Computer Science, 6th Edition 14 Assemblers and Assembly Language (continued) Advantages over machine code: Clarity, readability, and maintainability Can be placed at different locations in memory Pseudo-op: commands in the program directed to the assembler, not converted to machine instructions –.BEGIN and.END to mark where instructions are –.DATA to mark memory location as holding data: COUNTER:.DATA 0 X:.DATA DATA 12 Invitation to Computer Science, 6th Edition 15 Invitation to Computer Science, 6th Edition 16 Invitation to Computer Science, 6th Edition 18 19 Assemblers and Assembly Language (continued) Translation and loading: Assembler translates to machine language – Convert symbolic op codes to binary equivalents – Convert symbolic labels to memory addresses – Perform pseudo-op actions – Write object file containing machine instructions Loader gets program ready to run – Places instructions in memory – Triggers the hardware to run the program Invitation to Computer Science, 6th Edition 20 Assemblers and Assembly Language (continued) Converting symbolic op codes to binary ones Assembler maintains a table Assembler looks up symbolic op codes in the table and substitutes the binary analogue Use binary y search to optimize p table lookups p 21 Invitation to Computer Science, 6th Edition 27 Operating Systems System commands: user instructions about what the computer should do Demonstrate system commands of the DOS system: type “help” in the command line. Invitation to Computer Science, 6th Edition 30 Operating Systems (continued) User interface: user communicates with operating system Operating p g system y as receptionist p and dispatcher p User commandsystem software scheduled and runrepeat Text-based: – System commands typed at a prompt in a terminal – Command language must be learned GUI-based: –S t System d b commands i l/ by visual/mouse iinterface t f Invitation to Computer Science, 6th Edition 31 32 Invitation to Computer Science, 6th Edition 33 Operating Systems (continued) System security and protection: permit only authorized access to resources Operating p g system y as security ygguard Access protected by usernames and passwords – Superusers have more privileges – Encrypt data to increase security Folders and files have authorization lists: – read a file, add new information to a file, change existing information, delete a file Invitation to Computer Science, 6th Edition 34 Invitation to Computer Science, 6th Edition 35 Operating Systems (continued) Efficient allocation of resources: keep CPU busy and all programs making progress Operating p g system y as traffic cop p Multiple programs active at one time Every y program p g is in one of three states: – Running: program currently using the CPU – Waiting: programs waiting for I/O operations to complete – Ready: programs ready for a turn on CPU Keep a queue of ready programs and share Invitation to Computer Science, 6th Edition 36 Operating Systems (continued) Example of sharing CPU: Waiting Ready Running B A C A makes I/O request Waiting Ready Running A C B A finishes with I/O Waiting Ready Running C B A Invitation to Computer Science, 6th Edition 37 Operating Systems (continued) Safe use of resources: ensure that computer doesn’t get stuck in deadlock Multiple p p programs g requesting q g access to resources Deadlock occurs when all programs have some resources, and are waiting for resources held by others Deadlock prevention: if you can’t get all resources, release all you have and try again later Deadlock recovery: if no acknowledgement, send message again Invitation to Computer Science, 6th Edition 38 Deadlock http://www.comsci.us/os/notes/ch07.html Invitation to Computer Science, 6th Edition 39 Operating Systems (continued) Historical development of operating systems First generation: nearly “naked computer” – Programmer hand-loaded hand loaded programs Second generation: batch operating system – Programmers g g gave pprograms g to operators p – Operators collects a “batch” of programs Used I/O computer to translate programs to tape Ran programs as a group Used I/O computer to translate output to text/paper – Job control language: instructions to OS Invitation to Computer Science, 6th Edition 40 Operating Systems (continued) Third generation: multiprogrammed operating systems – Multiple p p programs g loaded at once – Switch between programs when I/O happens – Computer security now required! Privileged operations only available to administrator Bound memory a program can legitimately access Invitation to Computer Science, 6th Edition 43 Operating Systems (continued) Time-sharing system (also third generation) – Multiprogrammed, but users are on system interactively – Users need illusion of sole access – Allocate run time in time slices. Each program runs until til I/O OR time ti runs outt Invitation to Computer Science, 6th Edition 44 Invitation to Computer Science, 6th Edition 45 Operating Systems (continued) Fourth generation: network operating system – Operating system supports all the same local services – Also supports services that access resources that are available over a network Sh Shared d printer i t Servers: e-mail, data, web Connections to Internet – Real-time operating system or embedded system are special-purpose computers in other equipment Invitation to Computer Science, 6th Edition 46 Invitation to Computer Science, 6th Edition 47 Invitation to Computer Science, 6th Edition 48 Operating Systems (continued) Fifth generation, generation the near future – Multimedia interfaces (integrate images, speech, video seamlessly) – Parallel processing system, to perform multimedia and to permit larger scale tasks – Distributed Di t ib t d computingti environment, i t users don’t d ’t know where resources are stored Cloud computing p g Invitation to Computer Science, 6th Edition 49 Invitation to Computer Science, 6th Edition 50 Summary System software creates a virtual machine that is easy for users to use Assemblers and loaders are systemy software: translate human-friendly programs to machine language Assembly language uses symbolic names, symbolic op codes, and pseudo-ops to describe algorithms Assembler translates source programs to object files;; loader places p object j instructions in memoryy Invitation to Computer Science, 6th Edition 53 Summary (continued) Operating systems communicate with users through text or GUI actions The operating p g system y includes key y tasks such as: the user interface, system security, scheduling of programs, and system safety Operating systems developed through four generations of improvements, each adding new features and improving efficiency Future operating systems: parallel, distributed, and multimedia,, with resources stored remotelyy Invitation to Computer Science, 6th Edition 54