Ch6 System Software

By Debra Hart,2014-05-27 15:06
9 views 0
Ch6 System Software



     Chapter 6 System Software


     System software Assemblers and assembly language Operating systems


     Von Neumann computer

     ??Naked machine?? ? Difficult to use

     Store program in memory Put address of first instruction in PC,????

     Difficult to program

     Machine language instruction look like: 010100????

     Introduction (continued)

     An interface between the user and the hardware is needed to make a Von Neumann computer usable Use interface in our daily life, eg:

     Dashboard in a car ? Punch keys on a microwave

     System Software

     System software provides us with an simpler interface to operate and program the computer:

     A collection of many different programs ? Manages the resources of computers ? Acts as an intermediary between users and hardware ? Creates a virtual environment for the user that hides the actual computer architecture ? Allows user to access the hardware resources in a simple, safe and efficient way

     Figure 6.1 The Role of System Software

     Types of System Software

     Operating system

     Controls the overall operation of the computer ? Communicates with the user ? Determines what the user wants ? Activates system programs, applications packages, or user programs to carry out user requests

     Figure 6.2 Types of System Software

     Types of System Software (continued)

     User interface

     Graphical user interface (GUI) provides graphical control of the capabilities and services of the computer

     Language services

     Assemblers, compilers, and interpreters ? Allow you to write programs in a high-level, user-oriented language, and then execute them

     Types of System Software (continued)

     Memory managers

     Allocate and retrieve memory space

     Information managers

     Handle the organization, storage, and retrieval of information on

mass storage devices

     I/O systems

     Allow the use of different types of input and output devices

     Types of System Software (continued)


     Keeps a list of programs ready to run and selects the one that will execute next


     Collections of library routines that provide services either to user or other system routines

     Assembly Language

     Machine language

     Uses binary ? Allows only numeric memory addresses ? Difficult to change ? Difficult to create data

     Assembly Language (continued)

     Assembly languages

     Designed to overcome shortcomings of machine languages ? Create a more productive, user-oriented environment ? Earlier termed second-generation languages ? Now viewed as low-level programming languages

     Figure 6.3 The Continuum of Programming Languages

     Assembly Language (continued)

     Similar instruction as in machine-code, machineexcept:

     Can use symbolic names for instruction, address ? Values can be stated in decimal ? Can use comments

     Much simpler to use, for example, instead of 0001 000001001001

     We can write

     LOAD A --Load value of variable A into register --Load

     Assembly Instruction Format

     Label: Op-code mnemonic Address field

     Labels are used to mark the location of:

     Instruction we need to JMP to Memory locations (variables) we want to refer to

     Op-code mnemonic OpThe symbolic operation codes rather than numeric (binary) ones Address field The symbolic memory addresses rather than numeric (binary) ones

     Figure 6.4 Structure of a Typical Assembly Language Program

     Examples of Assembly Language Code

     Algorithmic operations

     Set the value of i to 1 (line 2). : Add 1 to the value of i (line 7).

     Examples of Assembly Language Code (continued)

     Assembly language translation

     --Put a 1 into register R. --Store the constant 1 into i. : INCREMENT

    I --Add 1 to memory location i. : I:.DATA 0 --The index value. Initially it is 0. ONE: .DATA 1 --The constant 1. LOAD ONE STORE I

     Examples of Assembly Language Code (continued)

     Arithmetic expression

     A=B+C?C7 (Assume that B and C have already been assigned values)

     Examples of Assembly Language Code (continued)

     Assembly language translation

     LOAD B --Put the value B into register R. ADD C --R now holds the sum (B + C). SUBTRACT SEVEN --R now holds the expression (B + C - 7). STORE A --Store the result into A. : --These data should be placed after the HALT. A: .DATA 0 B: .DATA 0 C: .DATA 0 SEVEN: .DATA 7 --The constant 7.

     Translation and Loading

     Source program

     An assembly language program

     Before a source program can be run, an assembler and a loader must be invoked

     Translation and Loading (continued)


     Translates a symbolic assembly language program into machine language

     Convert symbolic op codes to binary Convert symbolic addresses to binary Perform assembler services requested by the pseudo-ops Put translated instructions into a file for future use

     Translation and Loading (continued)

     Object program

     A machine language program


     Reads instructions from the object file and stores them into memory for execution

     Figure 6.5 The Translation/Loading/Execution Process

     Operating Systems

     Typical Types of system software ? Language translator

     Assemblers, compliers????

     Memory manager

     Allocate space for program execution

     File system

     Storage and retrival for mass storage devices


     Select a task to run


     Evolution of Computing System

     Batch processing

     the executing jobs without interaction with users ? Payroll system,

print monthly report job

     Figure 6.6 Batch processing

     Evolution of Computing System (continued)

     Interactive processing

     there??s interaction between users and computer ? Requires real-time processing, normally 3-5 seconds response time is acceptable ? Choosing curriculum

     Figure 6.7 Interactive processing

     Evolution of Computing System (continued)


     Implemented by Multiprogramming ? Time is divided into intervals and executing each job at one interval ? take turn to execute each job until all the jobs are executed ? If used in a single-user environment is called multitasking

     Evolution of Computing System (continued)

     Multiprocessor machines - assign different tasks to different processors - load balancing (dynamically allocating tasks to the various processors so that all processors are used efficiently) - scaling ( breaking tasks into a number of subtasks compatible with the number of processors available)

     Evolution of Computing System (continued)

     Network-wide operating system

     As the computer network popular, a network of individual OS can share the loading of a big tasks- cloud computing

     Evolution of Computing System (continued)

     Operating systems will continue to evolve Possible characteristics of next-generation systems

     Multimedia user interfaces ? Parallel processing systems ? Completely distributed computing environments

     Operating System Functions

     most important responsibilities of the operating system

     User interface management ? Control of access to system and files ? Efficient resource allocation ? Deadlock detection and error detection

     User Interface


     User Tasks

     Visual C++ Word processing Programming File management Games Networking Etc. File System Games E-mail

     Figure 6.8 User Interface Responsibility of the Operating System

     User Interface (continued)

     Types of user interface

     Command language (eg.DOS, Unix) By a prompt character ? Graphical user interface (eg. Windows) User icons, pull-down menu, scrolling pullwindows

     System Security And Protection

     The operating system must prevent Non-authorized people from using the computer

     Log in permissions ? File permissions ? System access level ? encryption

     Efficient Allocation Of Resources

     Consider the following code

     While j<10 While (PrinterStatus==??busy??) wait Print pagej j=j+1

     Processor time for the loop is 1/1000 second ? Printing time for a page is 1 minute ? How much idling time will the the processor do?

     Efficient Allocation Of Resources (continued)


     Execute another program while the first program waits for the printer

     The same approach is used for all input/output waits: printer, display, hardhard-drivers, network, etc

     Efficient Allocation Of Resources (continued)

     There are many programs that need to run at a given time


     Editing using Microsoft Word Surfing the net using a browser Compiling a C program

     But there is only one processor on a computer

     Efficient Allocation Of Resources (continued)

     Programs that are requested to run are divided into

     Running: the program executing on processor ? Ready: programs that are loaded to memory and ready to run ? Waiting: programs that cannot run, waiting for I/O or some other time consuming event

     Efficient Allocation Of Resources (continued)

     eg. In C when your program contains

     scanf(??%f??,&a); ? Processor won??t sit idle waiting for the user to enter something, if there are other tasks to run

     Safe Use Of Resources


     John borrowed book A from the library.

     John is holding book A but also needs book B to complete his assignment.

     Mary borrowed book B from the library.

     Mary is holding book B but also needs book A to complete her assignment.

     This is a deadlock situation. As a result, no one can complete his/her work.

     Figure 6.9 A deadlock resulting from competition for nonshareable railroad intersections

     Safe Use Of Resources (continued)


     Two processes are each holding a resource the other needs ? Neither process will ever progress

     Deadlock Example

     Program A Holds Requests Get disk drive Get laser printer Program B Get laser printer Get disk drive


     Processes block each other from continuing Conditions required for deadlock

     1. Competition for non-sharable resources 2. Resources requested on a partial basis 3. An allocated resource can not be forcibly retrieved The deadlock problem can be removed by attacking any one of the three.

     Deadlock detection and correction scheme

     An allocated resource can not be forcibly retrieved E.g. A process requires to create new process to perform subtasks while the process table is full. OS detects the deadlock and KILL some processes in the process table

     Deadlock avoidance scheme

     Condition 2: Resources requested on a partial basis e.g. To require each process to request all its resources at one time.

     Competition for non-sharable resources E.g. printer Solution : spooling

     Safe Use Of Resources (continued)

     The operating system must handle deadlocks

     Deadlock prevention ? Deadlock recovery


     System software acts as an intermediary between the users and the hardware Assembly language creates a more productive, user-oriented environment than machine language An assembler translates an assembly language program into a machine language program

     Summary (continued)

     Responsibilities of the operating system

     User interface management ? Program scheduling and activation ? Control of access to system and files ? Efficient resource allocation ? Deadlock detection and error detection


Report this document

For any questions or suggestions please email