DOC PREVIEW
Columbia COMS W4118 - OS Overview

This preview shows page 1-2-15-16-17-32-33 out of 33 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 33 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

W4118 Operating Systems OS OverviewJunfeng YangOutlineOS definitionsOS abstractions/conceptsOS structureOS evolutionWhat is OS?A program that acts as an intermediary between a user of a computer and the computer hardware.OSHWAppUserstuff betweenTwo popular definitions Top-down perspective: hardware abstraction layer, turn hardware into something that applications can useBottom-up perspective: resource manager/coordinator, manage your computers resourcesOS = hardware abstraction layerstandard library OS as virtual machineE.g. printf(hello world), shows up on screenApp can make system calls to use OS servicesWhy good?Ease of use: higher level of abstraction, easier to programReusability: provide common functionality for reuseE.g. each app doesnt have to write a graphics driverPortability / Uniformity: stable, consistent interface, different OS/version/hardware look same E.g. scsi/ide/flash disksWhy abstraction hard?What are the right abstractions ???Too low level ? Lose advantages of abstractionToo high level? All apps pay overhead, even those dont need Worse, may work against some apps E.g. DatabaseNext: example OS abstractionsTwo popular definitions Top-down perspective: hardware abstraction layer, turn hardware into something that applications can useBottom-up perspective: resource manager/coordinator, manage your computers resourcesOS = resource manager/coordinatorComputer has resources, OS must manage. Resource = CPU, Memory, disk, device, bandwidth, Memory managementFile system managementCPU schedulingNetwork stackOSMemoryCPU NICDiskSystem Call InterfaceHardwareShell gcc browserpptDevice driversDisk system managementOS = resource manager/coordinator (cont.)Why good?Sharing/Multiplexing: more than 1 app/user to use resourceProtection: protect apps from each other, OS from app Who gets what whenPerformance: efficient/fair access to resourcesWhy hard? Mechanisms v.s. policiesMechanism: how to do thingsPolicy: what will be doneIdeal case: general mechanisms, flexible policies Difficult to design rightOutlineOS definitionsOS abstractions/conceptsOS structureOS evolutionOS abstraction: processRunning program, stream of running instructions + process stateA key OS abstraction: the applications you use are built of processes Shell, powerpoint, gcc, browser, Easy to useProcesses are protected from each otherprocess = address spaceHide details of CPU, when&where to runProcess creation system callsint fork (void)Create a copy of the invoking processReturn process ID of new process in parentReturn 0 in childint execv (const char* prog, const char* argv[] )Replace current process with a new oneprog: program to runargv: arguments to pass to main()int wait (int * stat us)wait for a child to exitSimple Shell Example// parse user-typed com m and line into com m and and args// execute t he com m andswitch(pid = fork ()) { case -1: perror ( fork ); break; case 0: // child execv (com m and, args, 0); break; default : // parent wait (0); break; // wait for child to term inat e }Process communication system callsint pipe(int fds[2])Creates a one way communication channelfds[2] is used to return two file descriptorsBytes written to fds[1] will be read from fds[0]Often used together with fork() to create a channel between parent and childOS abstraction: threadminiprocesses, stream of instructions + thread stateConvenient abstraction to express concurrency in program execution and exploit parallel hardwareMore efficient communication than processesfor(;;) { int fd = accept_client (); create_thread(process_request , fd);}OS abstraction: fileArray of bytes, often persistent across rebootNice, clean way to read and write dataHide the details of disk devices (hard disk, CDROM, flash ) Related abstraction: directoryCollection of file entriesFile system callsint open(const char * path, int flags, int m ode)Opens a file and returns an integer called a file descriptor to use in other file system callsDefault file descriptors 0 = stdin, 1 = stdout, 2 = stderrint write(int fd, const char* buf, size_t sz)Writes sz bytes of data in buf to fd at current file offsetAdvance file offset by szint close(int fd)int dup2 (int oldfd, int newfd)makes newfd an exact copy of oldfdcloses newfd if it was validtwo file descriptors will share same offsetOutlineOS definitions and functionalitiesOS abstractions/conceptsOS structureOS evolutionOS structureCan define OS by structure: what goes into the kernel?Kernel: most interesting part of OS Can do everythingManages other parts of OSDifferent structures lead to differentPerformance, functionality, ease of use, security, reliability, portability, extensibility, cost, Tradeoffs depend on technology and workloadExample OS structure: monolithicMost traditional stuff in kernelUnix System ArchitectureExample OS structure: microkernelTry to move stuff out of kernelMinix 3 System ArchitectureExample OS structure: virtual machinesExports a fake hardware interface so that multiple OSes can run on top Non-virtual MachineVirtual MachineOutlineOS definitions and functionalitiesOS abstractions/conceptsOS structureOS evolutionOS evolutionMany outside factors affect OSUser needs + technology changes OS must evolveNew/better abstractions to usersNew/better algorithms to implement abstractionsNew/better low-level implementations (hw change)Current OS: evolution of these thingsMajor trend in HistoryHardware: cheaper and cheaperComputers/user: increasesTimeline70s: mainframe, 1 / organization80s: minicomputer, 1 / group90s: PC, 1 / user70s: mainframeHardware:Huge, $$$, slowIO: punch card, line printerOSsimple library of device drivers (no resource coordination)Human OS: single programmer/operator programs, runs, debugsOne job at a timeProblem: poor performance (utilization / throughput)Machine $$$, but idle most of the time because programmer slowBatch ProcessingBatch: submit group of jobs together to machineOperator collects, orders, runs (resource coordinator)Why good? can


View Full Document

Columbia COMS W4118 - OS Overview

Download OS Overview
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view OS Overview and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view OS Overview 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?