Presentation on theme: "CS U480: Systems & Networks 1. Introduction Donghui Zhang"— Presentation transcript:
1 CS U480: Systems & Networks 1. Introduction Donghui Zhang
2 Syllabus Instructor: Donghui Zhang Class page linked from my home page:
3 Your Background CSU380: Computer organization C/C++ programming System architecture: Processors, memory, I/O devicesProcessor architecture: ALU, instruction executionAssembly-level programmingC/C++ programmingFamiliarity with the C language and the standard C libraryPlease consult with me if you are unsure your background is sufficient
4 Why Programming For CS: must. For IS: also important. A pilot must know how to fly an airplane.For IS: also important.A project manager needs to have technical background.Bill Gates used to be a superb programmer.Guest speaker: Prof. Hafner.
5 Why C (and not Java) Talked with Mr. Feuer and Prof. Hafner. We provide guidance to what you should learn. (If you say “give us A without any exam or project”…)Most OS are implemented in C.Java hides many low-level details.This is a place to strengthen your C skills.
6 What is an Operating System? An operating system is a program that acts as an intermediary between a user of a computer and the computer hardware.Goals:Execute user programs and make solving user problems easier.Make the computer system convenient to use.Performance measures:Throughput: The total amount of work done over a period of time.Turnaround: The total time it takes to complete a job.
7 Concept Map Applications GUI Console OS CPU ALU Registers Memory PeripheralsDisksKeyboardMouseDisplay
8 Software Layers Application c = getc() Library read(…) Operating System kb_driver_read(…)Device driverread_device(…)
9 Compilation vs. Execution During compilation, statements in higher-level languages are converted into machine codeDuring execution, machine code is interpreted by a processorMemoryCompilerHigh-level language programAssembly languageAssemblerMachine codeLink editorLibraries ofExecutableSharedLibrariesOperatingSystemDeviceDrivers
10 Evolution of the OS In the beginning Whirlwind at MITPDP-1 from DECAltair from MITSProgram stored in a hardware patch board or toggled in using switchesProgram can access all of memoryProgram starts at location zeroLoading programs by hand is slow and error-prone and painful, so . . .nProgramMemory
11 Evolution of the OS: The Loader Create a very short program to load longer programsToggle in bootstrap loaderPrimitive loader may load in program or a more complex loader to read from cards or tapeLoading from cards is very slow, often took longer to load than to run, wasting (expensive) processor cycles, so . . .nLoaderProgramMemory
12 Evolution of the OS: Batch Processing Batch LoaderJobs are spooled on tapeWhile one batch of jobs is running, card reader writes next batch of jobs on tapeJobs are read sequentially from tape into memoryTape is still relatively slow compared to processingProgramMemory
13 The Concept of a JobWith the introduction of programming languages, a translator is needed to convert a program into machine codeWhen a program is stored on cards in the programming language, e.g., assembler or Fortran, it must be translated before it can be runExample: To run a program written in FortranLoad (machine code for) Fortran compilerRun compiler:Compiler reads program, writes machine codeLoad (machine code for) programRun program
14 Evolution of the OS: Multiprogramming Load next program while previous program is runningBut now both programs can’t begin at address zero (in fact, starting address isn’t known in advance)Solutions?Programs that perform lots of I/O waste (expensive) processor cyclesnLoaderProgram 2Program 1Memory
15 Evolution of the OS: Multitasking Share execution time among programsWhen one program starts I/O, let the other run.What is needed to switch from one program to another?A program bug in one program can overwrite another program, or the system programs and data, so . . .nLoader + schedulerSystem dataProgram 2Program 1Memory
16 Evolution of the OS: Protection Run programs in separate address spacesSystem programs need to cross address spaces.System runs in privileged mode.The more programs in memory, the less memory available for each program, so . . .MemoryLoader, scheduler, memory mgrProgram 1Program 2System dataProgram 3n
17 Evolution of the OS: Virtual Memory Address space implemented in both main and secondary memoryBroken into pagesA program’s address space is a set of pages.The address space for a program may be larger than main memory!Pages are swapped in and out of main memory as needed.MemoryLoader, scheduler, memory mgr, resource mgrDiskn
18 OS Diversity Great diversity of programmable hardware Super computers: simulation, scene generation, data miningServers: database, web, videoPersonal: desktop, laptopEmbedded: PDA, phone, media deviceNature of the OS depends onApplication mixHardware capabilityReal-time requirementsWith the proliferation of embedded systems, most processors do not run a general purpose OS
19 OSes are complex programs developed over many years by many people They confront common problems that reappear in other contextsThe problems have been formalizedA variety of solutions have been proposed and implementedChoosing a solution requires evaluating tradeoffs of space, time, and complexityOSes are a rich source of well-designed sample programsWe will study OSes by exploring common componentsUnderstand the motivation for each componentUnderstand the tradeoffs for each implementation
20 Common System Components Process ManagementMain-Memory ManagementFile SystemI/O SystemNetwork ManagementLet’s take a high-level tour of these components
21 Process Management A process is a program in execution To accomplish its task, a process needs certain resources:CPU timeMemoryFilesI/O devices.The OS is responsible for the following activities in connection with processes:Process creation and deletionProcess suspension and resumptionMechanisms for:Process synchronizationInter-process communication
22 From Program to Process MemoryCompilerHigh-level language programAssembly languageAssemblerMachine codeLink editorLibraries ofExecutableSharedLibrariesOperatingSystemDeviceDrivers
23 Memory Management Main memory is a large array of words Each word (or, often byte) has its own addressData in memory is shared by the CPU and I/O devicesMain memory is (usually) volatileIt loses its contents in the case of system failure.The OS is responsible for the following activities in connection with memory management:Keep track of which parts of memory are currently being used and by whom.Decide which processes to load when memory space becomes available.Allocate and deallocate memory space as needed.
25 Secondary-Storage Management Secondary storage is (usually) a large array of blocksEach block has its own addressData is moved between main memory and secondary storage in units of blocksSecondary storage is non-volatile and can be very largeDisks are the most common in general purpose systemsMemory cards and stick are common on portable devicesThe OS is responsible for the following activities in connection with secondary storage management:Free space managementStorage allocationFor disks, scheduling of block transfers
27 File Management A file is a collection of related information Files are stored within a file systemFrom the view of most systems, a file is an array of bytesThe OS is responsible for the following activities in connections with file management:File creation and deletionDirectory creation and deletionSupport of primitives for manipulating files and directoriesMapping files onto secondary storage.File backup on stable (nonvolatile) storage media
28 I/O System ManagementInput/Output refers to the movement of data between main memory and peripheral devicesDevices vary widely in their operation and behaviorDevices are partitioned into classes to factor common behaviorA device driver translates between general OS operations and device-specific commandsI/O managements consists ofA buffer-caching systemA general device-driver interfaceDrivers for specific hardware devices
30 Network ManagementNetworking allows distinct computer systems to exchange dataCommunication takes place using a protocolNetworked computers vary widely in their degree of coupling:They may share a common OS and processes may be visible across systemsThey may share nothing except a communication portNetworking allows users to access to non-local resources, allowing:Computation speed-up, through special purpose hardware or parallel processingAvailability of data from other systemsEnhanced reliability through redundancy