39

INPUT & OUTPUT DEVICES

Embed Size (px)

DESCRIPTION

COMPUTER DATA

Citation preview

  • Computer Application in Architectures

    Computer Application in Architectures

  • *

  • Computer hardware is a physical components of the computer. Chapter 1*Software is a general term for the various kinds of programs used to operate computers and related devices. (The term hardware describes the physical aspects of computers and related devices.)

    Chapter 1

  • Input/OutputLecture 1 - *

  • Input/OutputLecture 1 - *Historical Context of Storage and I/OSecondary and Tertiary Storage DevicesStorage I/O Performance MeasuresQueuing TheoryProcessor Interface IssuesI/O BusesRedundant Arrays of Inexpensive Disks (RAID)File SystemsI/O BenchmarksFile System PerformanceComputer Application in Architectures

    Computer Application in Architectures

  • Sir Kashif

    Chapter 1

  • A program that runs on the raw hardware and supportsResource AbstractionResource SharingAbstracts and standardizes the interface to the user across different types of hardwareVirtual machine hides the messy details which must be performedManages the hardware resourcesEach program gets time with the resourceEach program gets space on the resourceMay have potentially conflicting goals:Use hardware efficientlyGive maximum performance to each userChapter 1*

    Chapter 1

  • First generation: 1945 1955Vacuum tubesPlug boardsSecond generation: 1955 1965TransistorsBatch systemsThird generation: 1965 1980Integrated circuitsMultiprogrammingFourth generation: 1980 presentLarge scale integrationPersonal computersNext generation: ???Systems connected by high-speed networks?Wide area resource management?Chapter 1*

    Chapter 1

  • Run one job at a timeEnter it into the computer (might require rewiring!)Run itRecord the resultsProblem: lots of wasted computer time!Computer was idle during first and last stepsComputers were very expensive!Goal: make better use of an expensive commodity: computer timeChapter 1*

    Chapter 1

  • Bring cards to 1401Read cards onto input tapePut input tape on 7094Perform the computation, writing results to output tapePut output tape on 1401, which prints outputChapter 1*

    Chapter 1

  • Original batch systems used tape drivesLater batch systems used disks for bufferingOperator read cards onto disk attached to the computerComputer read jobs from diskComputer wrote job results to diskOperator directed that job results be printed from diskDisks enabled simultaneous peripheral operation on-line (spooling)Computer overlapped I/O of one job with execution of anotherBetter utilization of the expensive CPUStill only one job active at any given timeChapter 1*

    Chapter 1

  • Multiple jobs in memoryProtected from one anotherOperating system protected from each job as wellResources (time, hardware) split between jobsStill not interactiveUser submits jobComputer runs itUser gets results minutes (hours, days) laterChapter 1*Operating systemJob 1Job 2Job 3Memory partitions

    Chapter 1

  • Multiprogramming allowed several jobs to be active at one timeInitially used for batch systemsCheaper hardware terminals -> interactive useComputer use got much cheaper and easierNo more priesthoodQuick turnaround meant quick fixes for problems

    Chapter 1*

    Chapter 1

  • *The creation and deletion of both user and system processesb. The suspension and resumption of processesc. The provision of mechanisms for process synchronizationd. The provision of mechanisms for process communicatione. The provision of mechanisms for deadlock handling

  • Mainframe operating systems: MVSServer operating systems: FreeBSD, SolarisMultiprocessor operating systems: Cellular IRIXPersonal computer operating systems: Windows, UnixReal-time operating systems: VxWorksEmbedded operating systemsSmart card operating systemsSome operating systems can fit into more than one categoryChapter 1*

    Chapter 1

  • Chapter 1*Hard drive controllerVideo controllerMemoryUSB controllerNetwork controllerOutside worldCPUComputer internals (inside the box)

    Chapter 1

  • Chapter 1*Execute unitExecute unitExecute unitExecute unitBufferFetch unitDecode unitFetch unitDecode unitFetch unitDecode unitPipelined CPUSuperscalar CPU

    Chapter 1

  • Goal: really large memory with very low latencyLatencies are smaller at the top of the hierarchyCapacities are larger at the bottom of the hierarchySolution: move data between levels to create illusion of large memory with low latencyChapter 1*Access latency1 ns25 ns50 ns5 ms50 sec< 1 KB1 MB256 MB40 GB> 1 TBCapacityBetterBetter

    Chapter 1

  • Data stored on surfacesUp to two surfaces per platterOne or more platters per diskData in concentric tracksTracks broken into sectors256B-1KB per sectorCylinder: corresponding tracks on all surfacesData read and written by headsActuator moves headsHeads move in unisonChapter 1*sectorcylinderplatterspindletrackheadactuatorsurfaces

    Chapter 1

  • Single base/limit pair: set for each processTwo base/limit registers: one for program, one for dataChapter 1*User program and dataUser program and dataOperating systemAddress0x1dfff0x230000x27fff0x2b0000x2ffff0BaseLimitUser dataUser programOperating systemUser dataBase1Limit2Limit1Base2Address0x1dfff0x230000x290000x2bfff0x2ffff00x2d0000x24fff

    Chapter 1

  • Left: sequence as seen by hardwareRequest sent to controller, then to diskDisk responds, signals disk controller which tells interrupt controllerInterrupt controller notifies CPURight: interrupt handling (software point of view)Chapter 1*Interrupt controllerCPU5Disk controller32614InstructionnOperating systemInstructionn+1Interrupt handler1: Interrupt2: Process interrupt3: Return

    Chapter 1

  • Many of these should be familiar to Unix usersProcesses (and trees of processes)DeadlockFile systems & directory treesPipesWell cover all of these in more depth later on, but its useful to have some basic definitions now

    Chapter 1*

    Chapter 1

  • Process: program in executionAddress space (memory) the program can useState (registers, including program counter & stack pointer)OS keeps track of all processes in a process tableProcesses can create other processesProcess tree tracks these relationshipsA is the root of the treeA created three child processes: B, C, and DC created two child processes: E and FD created one child process: GChapter 1*ABEFCDG

    Chapter 1

  • Processes have three segmentsText: program codeData: program dataStatically declared variablesAreas allocated by malloc() or newStackAutomatic variablesProcedure call informationAddress space growthText: doesnt growData: grows upStack: grows downChapter 1*StackDataText0x7fffffff0Data

    Chapter 1

  • Chapter 1*Keep track of which parts of memory are currently being used and by whom.

    Decide which processes are to be loaded into memory when memory s pace become s available.

    Allocate and d eallocate memory space as needed.

    Chapter 1

  • Chapter 1*Potential deadlockActual deadlock

    Chapter 1

  • Chapter 1*Root directorybinfacultygradslspscpcshelmsbrandtkagamer4stuffclassesresearchstuff

    Chapter 1

  • Processes want to exchange information with each otherMany ways to do this, includingNetworkPipe (special file): A writes into pipe, and B reads from itChapter 1*AB

    Chapter 1

  • Programs want the OS to perform a serviceAccess a fileCreate a processOthersAccomplished by system callProgram passes relevant information to OSOS performs the service ifThe OS is able to do soThe service is permitted for this program at this timeOS checks information passed to make sure its OKDont want programs reading data into other programs memory!Chapter 1*

    Chapter 1

  • System call: read(fd,buffer,length)Program pushes arguments, calls libraryLibrary sets up trap, calls OSOS handles system callControl returns to libraryLibrary returns to user programChapter 1*Return to callerTrap to kernelTrap code in registerIncrement SPCall readPush argumentsDispatchSys call handlerKernel space (OS)User space00xffffffff139Library (read call)User code

    Chapter 1

  • Chapter 1*

    CallDescriptionfd = open(name,how)Open a file for reading and/or writings = close(fd)Close an open filen = read(fd,buffer,size)Read data from a file into a buffern = write(fd,buffer,size)Write data from a buffer into a files = lseek(fd,offset,whence)Move the current pointer for a files = stat(name,&buffer)Get a files status information (in buffer)s = mkdir(name,mode)Create a new directorys = rmdir(name)Remove a directory (must be empty)s = link(name1,name2)Create a new entry (name2) that points to the same object as name1s = unlink(name)Remove name as a link to an object (deletes the object if name was the only link to it)

    Chapter 1

  • Chapter 1*

    CallDescriptionpid = fork()Create a child process identical to the parentpid=waitpid(pid,&statloc,options)Wait for a child to terminates = execve(name,argv,environp)Replace a process core imageexit(status)Terminate process execution and return statuss = chdir(dirname)Change the working directorys = chmod(name,mode)Change a files protection bitss = kill(pid,signal)Send a signal to a processseconds = time(&seconds)Get the elapsed time since 1 Jan 1970

    Chapter 1

  • while (TRUE) {/* repeat forever */ type_prompt( );/* display prompt */ read_command (command, parameters)/* input from terminal */ if (fork() != 0) {/* fork off child process */ /* Parent code */ waitpid( -1, &status, 0);/* wait for child to exit */} else { /* Child code */ execve (command, parameters, 0);/* execute command */ }} Chapter 1*

    Chapter 1

  • Chapter 1*Main procedureService routinesUtility routines

    Chapter 1

  • First widely used in VM/370 with CMSAvailable today in VMwareAllows users to run any x86-based OS on top of Linux or NTGuest OS can crash without harming underlying OSOnly virtual machine failsrest of underlying OS is fineGuest OS can even use raw hardwareVirtual machine keeps things separatedChapter 1*Bare hardwareLinuxVMwareLinuxApp1App2App3VMwareVMwareWindows NTFreeBSDI/O instructionsSystem callsCalls to simulate I/OReal I/O instructions

    Chapter 1

  • Processes (clients and OS servers) dont share memoryCommunication via message-passingSeparation reduces risk of byzantine failuresExamples include MachChapter 1*MicrokernelClient processProcess serverTerminal serverClient processFile serverMemory serverUser modeKernel mode

    Chapter 1

  • Chapter 1*

    Exp.NumberPrefixExp.NumberPrefix10-30.001milli1031,000Kilo10-60.000001micro1061,000,000Mega10-90.000000001nano1091,000,000,000Giga10-120.000000000001pico10121,000,000,000,000Tera10-150.000000000000001femto10151,000,000,000,000,000Peta10-180.000000000000000001atto10181,000,000,000,000,000,000Exa

    Chapter 1

  • Bubble sort, also known as sinking sort, is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.

    A bubble sort, a sorting algorithm that continuously steps through a list, swapping items until they appear in the correct order.

    Chapter 1

  • Chapter 1

    Let us take the array of numbers "5 1 4 2 8", and sort the array from lowest number to greatest number using bubble sort algorithm. In each step, elements written in bold are being compared.

    First Pass:( 5 1 4 2 8 ) ( 1 5 4 2 8 ), Here, algorithm compares the first two elements, and swaps them.( 1 5 4 2 8 ) ( 1 4 5 2 8 ), Swap since 5 > 4( 1 4 5 2 8 ) ( 1 4 2 5 8 ), Swap since 5 > 2( 1 4 2 5 8 ) ( 1 4 2 5 8 ), Now, since these elements are already in order (8 > 5), algorithm does not swap them.Second Pass:( 1 4 2 5 8 ) ( 1 4 2 5 8 )( 1 4 2 5 8 ) ( 1 2 4 5 8 ), Swap since 4 > 2( 1 2 4 5 8 ) ( 1 2 4 5 8 )( 1 2 4 5 8 ) ( 1 2 4 5 8 )Now, the array is already sorted, but our algorithm does not know if it is completed. The algorithm needs one whole pass without any swap to know it is sorted.Third Pass:( 1 2 4 5 8 ) ( 1 2 4 5 8 )( 1 2 4 5 8 ) ( 1 2 4 5 8 )( 1 2 4 5 8 ) ( 1 2 4 5 8 )( 1 2 4 5 8 ) ( 1 2 4 5 8 )Finally, the array is sorted, and the algorithm can terminate.

    Analogue types of Computer uses what is known as analogue signals that are represented by a continuous set of varying voltages and are used in scientific research centers?, hospitals and flight centersWith analogue types of computer no values are represented by physical measurable quantities e.g. voltages. Analogue computer types program arithmetic and logical operations by measuring physical changes i.e. temperatures or pressure.

    Digital Computer typeWith these types of computers operation are on electrical input that can attain two inputs, states of ON=1 and state of OFF = 0. With digital type of computers data is represented by digital of 0 and 1 or off state and on state. Digital computer type recognizes data by counting discrete signal of (0 0r 1), they are high speed programmable; they compute values and stores results. After looking at the Digital computer type and how it functions will move to the third computer type as mentioned above.

    Hybrid type of ComputerHybrid computer types are very unique, in the sense that they combined both analogue and digital features and operations. With Hybrid computers operate by using digital to analogue convertor and analogue to digital convertor. By linking the two types of computer above you come up with this new computer type called Hybrid.

    ***Got here on the first day of class.