Upload
jasmine-macdonald
View
219
Download
0
Tags:
Embed Size (px)
Citation preview
Advanced Operating Advanced Operating SystemsSystems
Prof. Muhammad Saeed
Computer Science 2
Course Name: Advanced Operating SystemsCourse Structure: 3 + 0 Course Code: CS703
Text Books/Reference Books:1) Modern Operating Systems by A. S. Tanenbaum 3rd Edition2) Distributed Systems: Concepts and Design by Coulouris, Dollimore, and
Kindberg, 3rd Edition. 3) Distributed Operating Systems: Concepts and Design by Paradeep K. Sinha4) Advanced Concepts in Operating Systems by Singhal and Shiviratri
3Computer Science
Def. in nutshellIt manages hardware resources and provides abstract set of resources.
Web Browser
E-mail ReaderVideo Player
User Interface Program
Operating System
Hardware
User Mode
Kernel Mode
What is an Operating System ?What is an Operating System ?
Computer Science 4
• Program developmento Editors and debuggers
• Program execution• Access to I/O devices• Controlled access to files• System access
Services Provided by the Operating SystemServices Provided by the Operating System
Computer Science 5
• 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 Science 6
1) Charles Babbage hired Ada Lovelace as world’s first programmer.2) Vacuum Tubes. Electronic Circuits. 1945-553) Transistors.During 1955-65 Batch System was implemented. Punch Cards introduced.
Computer Science 7
4) 1965-80, IC’s 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 60’s.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 Systemsviii) 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 Science 8
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 Science 9
A processor is hardware that executes machine-languageCPU executes the instructions of a programCoprocessor 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 itInstruction length is the size of a machine-language
instruction• Some processors support multiple instruction
lengths.
Holding Buffer
Execute Unit
Execute Unit
Execute Unit
Computer Science 11
Computer time is measured in cyclesOne complete oscillation of an electrical signalProvided by system clock generatorProcessor speeds are measured in GHz (billions of cycles
per second)• Modern desktops execute at hundreds of megahertz or
several GHz
Computer Science 12
The memory hierarchy is a scheme for categorizing memoryFastest 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 Science 13
Computer Science 14
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 L 2
L 2 L 2
A quad-core chip with shared L2 Cache A quad-core chip with separate L2 Cache
Computer Science 15
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 Science 16
Computer Science 17
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 Science 18
A bus is a collection of tracesTraces 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 system’s
main processors
Computer Science 19
Starting up a computerInitial program, or bootstrap program, is runStored in ROM or EPROM within the computer hardwareInitializes all aspects of the computer (registers,
controllers, memory etc.)Loads the operating system and executes it
• Locates and loads the OS kernelOnce 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 Science 20
Interrupts enable software to respond to signals from hardwareMay 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 Science 21
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 vectorTo 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 Science 22
Computer Science 23
Computer Science 24
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 OSReturns the data or pointer to the data if a read was doneFor other operations it returns status information
Computer Science 25
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 interruptAt 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 Science 27
• 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 Science 28
Computer Science 29
Uniprogramming Multiprogramming
Processor use 22% 43%
Memory use 30% 67%
Disk use 33% 67%
Printer use 33% 67%
Elapsed time 30 min. 15 min.
Throughput rate 6 jobs/hr 12 jobs/hr
Mean response time 18 min. 10 min.
Computer Science 30
• 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 Science 31
• 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 Science 32
Monolithic SystemsLayered SystemsMicrokernelsClient-Server ModelVirtual MachinesExokernels.
Computer Science 33
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 Science 34
Layered Systems
Computer Science 35
Microkernels:
Splitting into well-defined modules Very few instructions in kernel modeA few of microkernel systems are QNX, Symbian,
MINIX 3 etc.Lesser bugs and rare system crash.
Computer Science 36
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 Science 37
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 Science 38
Exokernals: Rather than cloning the machine
partitioning is used, giving users subset of resources.
Exokernal allocates resources to virtual machines.
Remapping is not needed.
Computer Science 39
END