Presentation on theme: "Advanced Operating Systems Prof. Muhammad Saeed. Computer Science2 Course Name: Advanced Operating Systems Course Structure: 3 + 0 Course Code: CS703."— Presentation transcript:
Advanced Operating Systems Prof. Muhammad Saeed
Computer Science2 Course Name: Advanced Operating Systems Course Structure: Course Code: CS703 Text Books/Reference Books: 1) Modern Operating Systems by A. S. Tanenbaum 3 rd Edition 2) Distributed Systems: Concepts and Design by Coulouris, Dollimore, and Kindberg, 3 rd Edition. 3) Distributed Operating Systems: Concepts and Design by Paradeep K. Sinha 4) Advanced Concepts in Operating Systems by Singhal and Shiviratri
3Computer Science Def. in nutshell It manages hardware resources and provides abstract set of resources. Web Browser Reader Video Player User Interface Program Operating System Hardware User Mode Kernel Mode What is an Operating System ?
Computer Science4 Program development o Editors and debuggers Program execution Access to I/O devices Controlled access to files System access Services Provided by the Operating System
Computer Science5 Error detection and response internal and external hardware errors memory error device failure software errors arithmetic overflow access forbidden memory locations operating system cannot grant request of application
Computer Science6 1)Charles Babbage hired Ada Lovelace as worlds first programmer. 2)Vacuum Tubes. Electronic Circuits )Transistors.During Batch System was implemented. Punch Cards introduced.
Computer Science7 4) , ICs and Multiprogramming, spooling (Simultaneous Peripheral Operation On Line), introductory timesharing. IBM System 360, PDP series, MULTICS ( Multiplexed Information and Computing Service) System V and BSD versions of UNIX (UNICS). 5)1980-,LSI,Microcomputers. i)CPM(Control Program for Microcomputers), Kildall wrote for 8080 and Zilog Z80, ii)IBM PC Bill Gates provided DOS(Disk Operating System)/Basic package for IBM PC. iii)Engelbert invented GUI at Stanford Research Institute in the 60s. iv)Steve Jobs used GUI in Apple Macintosh. v)in 1985 Microsoft developed Windows. Windows 95 was a real GUI based System. vi)UNIX System with X Windows. vii)Network and Distributed Operating Systems viii)Multiprocessor Operating Systems. ix)Handheld Computer Operating Systems. x)Embedded Operating Systems. xi)Sensor Node Operating Systems. xii)Real-Time Operating Systems. xiii)Smart Card Operating Systems.
Computer Science8 Processor - traditionally controls the operation of the computer and performs the data processing function Memory - Stores data and programs, typically volatile (aka real or primary memory) I/O modules - move data between computer and external environment (i.e. disks, network) System Bus - communication among processors, memory, and I/O modules
Computer Science9 A processor is hardware that executes machine-language CPU executes the instructions of a program Coprocessor executes special-purpose instructions Ex., graphics or audio coprocessors Registers are high-speed memory located on processors Data must be in registers before a processor can operate on it Instruction length is the size of a machine-language instruction Some processors support multiple instruction lengths.
Holding Buffer Execute Unit
Computer Science11 Computer time is measured in cycles One complete oscillation of an electrical signal Provided by system clock generator Processor speeds are measured in GHz (billions of cycles per second) Modern desktops execute at hundreds of megahertz or several GHz
Computer Science12 The memory hierarchy is a scheme for categorizing memory Fastest and most expensive at the top, slowest and least expensive at the bottom Registers L1 Cache L2 Cache Main Memory Secondary and tertiary storage (CDs, DVDs and floppy disks) Main memory is the lowest data referenced directly by processor Volatile – loses its contents when the system loses power
Computer Science14 Core 1 L1 Core 2 L1 Core 3 L1 Core 4 L1 L 2 Cache Core 1 L1 Core 2 L1 Core 3 L1 Core 4 L1 L 2 A quad-core chip with shared L2 Cache A quad-core chip with separate L2 Cache
Computer Science15 Use of high-speed memory to hold recently-accessed data. Requires a cache management policy. Careful selection of the cache size and of a replacement policy can result in 80 to 99 percent of all accesses being in cache greatly improving performance Caching introduces another level in storage hierarchy. This requires data that is simultaneously stored in more than one level to be consistent.
Computer Science17 Device port. Serial Port. Parrallel Port USB (Universal Serial Bus) The computer acts as the host. Up to 127 devices can connect to the host, either directly or by way of USB hubs. Individual USB cables can run as long as 5 meters; with hubs, devices can be up to 30 meters. With USB 2.0,the bus has a maximum data rate of 480 megabits per second. With USB 3.0, data rate is 5 gbits/sec. While USB 2.0 can only send data in one direction at a time, USB 3.0 can transmit data in both directions simultaneously. USB of 256 GB capacity are available.
Computer Science18 A bus is a collection of traces Traces are thin electrical connections that transport information between hardware devices A port is a bus that connects exactly two devices An I/O channel is a bus shared by several devices to perform I/O operations Handle I/O independently of the systems main processors
Computer Science19 Starting up a computer Initial program, or bootstrap program, is run Stored in ROM or EPROM within the computer hardware Initializes all aspects of the computer (registers, controllers, memory etc.) Loads the operating system and executes it Locates and loads the OS kernel Once loaded, the OS waits for an event to occur Events usually signaled by an interrupt from either the hardware or software Hardware sends a signal to the CPU via the system bus Software triggers an interrupt by executing a system call
Computer Science20 Interrupts enable software to respond to signals from hardware May be initiated by a running process Interrupt is called a trap – software generated caused by error or user request for an OS service Dividing by zero or referencing protected memory May be initiated by some event that may or may not be related to the running process Key is pressed on a keyboard or a mouse is moved Low overhead Polling is an alternative approach – Processor repeatedly requests the status of each device – Increases in overhead as the complexity of the system increases
Computer Science21 After receiving an interrupt, the processor completes execution of the current instruction, then pauses the current process The processor will then transfer to a fixed location and executes the service routine for the interrupt The interrupt handler determines how the system should respond Interrupt handlers are stored in an array of pointers called the interrupt vector To handle the interrupt quickly, a table of pointers is generally stored in low memory which hold the addresses of the ISR for the various devices This array, or interrupt vector, of addresses is then indexed by a unique device number to provide the address of the ISR for the interrupting device After the interrupt handler completes, the interrupted process is restored and execution continues from the address of the interrupted instruction (stored on stack) or the next process is executed
Computer Science24 To start an I/O operation, the CPU loads the appropriate registers within the device controller The device controller examines the values and determines what action to take (e.g. read, write) When the transfer is complete, the device controller informs the CPU via an interrupt The device driver returns control to the OS Returns the data or pointer to the data if a read was done For other operations it returns status information
Computer Science25 Synchronous: After I/O starts, control returns to user program only upon I/O completion. Wait instruction or tight loop ( Loop: jmp Loop ) idles the CPU until the next interrupt At most one I/O request is outstanding at a time, no simultaneous I/O processing. Asynchronous: After I/O starts, control returns to user program without waiting for I/O completion. Increased system efficiency by increasing CPU utilization
Device-status table contains entry for each I/O device indicating its type, address, and state. Operating system indexes into I/O device table to determine device status and to modify table entry to include interrupt. If the device is busy with a request, the type of request and other parameters are stored in the table entry for that device A queue will contain a list of all those requests waiting for a device
Computer Science27 Processor has more than one program to execute The sequence the programs are executed depend on their relative priority and whether they are waiting for I/O After an interrupt handler completes, control may not return to the program that was executing at the time of the interrupt
Computer Science29 UniprogrammingMultiprogramming Processor use22%43% Memory use30%67% Disk use33%67% Printer use33%67% Elapsed time30 min.15 min. Throughput rate6 jobs/hr12 jobs/hr Mean response time18 min.10 min.
Computer Science30 Reduce setup time by batching jobs with similar requirements. Add a card reader, Hire an operator User is NOT the operator Automatic job sequencing Forms a rudimentary OS. Resident Monitor Holds initial control, control transfers to job and then back to monitor. Problem Need to distinguish job from job and data from program.
Computer Science31 Programs queued for execution in FIFO order. Like multiprogramming, but timer device interrupts after a quantum (time slice). Interrupted program is returned to end of FIFO Next program is taken from head of FIFO Control card interpreter replaced by command language interpreter. Interactive (action/response) When OS finishes execution of one command, it seeks the next control statement from user. File systems Online file system is required for users to access data and code. Virtual memory Job is swapped in and out of memory to disk.
Computer Science32 Monolithic Systems Layered Systems Microkernels Client-Server Model Virtual Machines Exokernels.
Computer Science33 Monolithic Systems Entire Operating System as kernel. All individual procedures first compiled then linked together. No information hiding. One service procedure for each system call. There may be some user mode and kernel mode. loadable I/O device drivers loaded on demand.
Computer Science34 Layered Systems
Computer Science35 Microkernels: Splitting into well-defined modules Very few instructions in kernel mode A few of microkernel systems are QNX, Symbian, MINIX 3 etc. Lesser bugs and rare system crash.
Computer Science36 Client-Server Model: Divided into client processes and server processes Communication between client and server generally done by message passing. Client and server can be on the same computer.. Web operates in this way
Computer Science37 Virtual Machines: Copy of hardware, kernel/user mode, I/o, interrupts etc. Can run any operating system coexisting with other operating systems Any call is trapped in the operating system of the virtual machine. Virtualization in the web hosting world uses virtual machines to implement virtualization. CPU must be virtualizable to run previleged instructions. Type 1 hypervisor run on hardware but type II hypervisor runs on top of host operating system.
Computer Science38 Exokernals: Rather than cloning the machine partitioning is used, giving users subset of resources. Exokernal allocates resources to virtual machines. Remapping is not needed.