Introduction to Operating Systems Y ücel Saygın | Some of these slides are based on your text book and on the slides prepa...
Early Computers <ul><li>Charles Babbage (1791-1871) designed the first true digital computer called the analytical engine....
Early Computers <ul><li>Babbage also thought of the concept of software </li></ul><ul><li>And hired the first programmer (...
Current Computer Systems <ul><li>A computer system consists of </li></ul><ul><ul><li>hardware </li></ul></ul><ul><ul><li>s...
What is an Operating System <ul><li>It is the software that enables us the use the hardware </li></ul><ul><li>It is a reso...
History of Computing http://www.computerhistory.org/ <ul><li>Hewlett Packard was founded in 1939 by  David Packard and Bil...
History of Computing http://www.computerhistory.org/ <ul><li>Computer wars:  </li></ul><ul><ul><li>Germany vs Britain </li...
History of Operating Systems (2) <ul><li>First generation 1945 - 1955 </li></ul><ul><ul><li>vacuum tubes, plug boards </li...
A Famous Remark! <ul><li>&quot;I think there is a world market for maybe five computers.&quot;  </li></ul><ul><ul><li>Thom...
History of Operating Systems (2) <ul><li>Second generation 1955 – 1965 </li></ul><ul><ul><li>transistors, batch systems </...
History of Operating Systems (3) <ul><li>Structure of a typical Fortran Monitoring System job – a 2 nd  generation operati...
History of Operating Systems (1) <ul><li>Early batch system </li></ul><ul><ul><li>bring cards to IBM 1401 machine (good at...
Famous Remarks <ul><li>&quot;I have traveled the length and breadth of this country and talked with the best people, and I...
History of Operating Systems <ul><li>Third generation  1965 – 1980 </li></ul><ul><ul><li>Integrated Circuits  </li></ul></...
History of Operating Systems <ul><li>Third generation  1965 – 1980 </li></ul><ul><ul><li>Integrated Circuits and multiprog...
History of Operating Systems <ul><li>Third generation  1965 – 1980 </li></ul><ul><ul><li>OS/360 was the operating system o...
History of Operating Systems (4) <ul><li>Multiprogramming system   </li></ul><ul><ul><li>three jobs in memory – 3 rd  gene...
History of Operating Systems (4) <ul><li>The concept of  spooling  was introduced by 3 rd  generation operating systems </...
History of OS <ul><li>MULTICS, another third generation OS introduced the concept of client server computing and influence...
History of OS <ul><li>Tanenbaum wrote a version of UNIX called MINIX with POSIX support for educational use. </li></ul><ul...
History of Operating Systems (4) <ul><li>Fourth generation 1980 – present </li></ul><ul><ul><li>personal computers were de...
Famous Remark <ul><li>“ There is no reason anyone would want a computer in their home.“ </li></ul><ul><ul><li>Ken Olson, p...
History of Operating Systems (4) <ul><li>Bill Gates suggested IBM that they should look at CP/M (one of the the most succe...
History of Operating Systems (4) <ul><li>Early MS-DOS was very primitive  but later versions included  advanced features t...
Famous Remark <ul><li>“ We don't see Windows as a long-term graphical interface for the masses.“ </li></ul><ul><ul><li>A L...
History of Operating Systems (4) <ul><li>Steve Jobs saw the value of GUI in a PC and developed  the Apple computer with GU...
History of Operating Systems (4) <ul><li>Microsoft developed a GUI-based system called Windows which originally ran on top...
Interesting TV Series <ul><li>Pirates of Silicon Valley </li></ul><ul><ul><li>Available in information center as VHS  </li...
The Operating System Zoo <ul><li>Mainframe operating systems </li></ul><ul><ul><li>Room-size computers </li></ul></ul><ul>...
Famous Forcast <ul><li>&quot;Computers in the future may weigh no more than 1.5 tons.&quot; – </li></ul><ul><ul><li>Popula...
The Operating System Zoo <ul><li>Server operating systems </li></ul><ul><ul><li>Offer services like print, file, or web </...
The Operating System Zoo <ul><li>Real-time operating systems </li></ul><ul><ul><li>E.g. industrial process control systems...
Computer Architecture <ul><li>Evolution: </li></ul><ul><ul><li>Charles Babbage:  </li></ul></ul><ul><ul><ul><li>Difference...
Computer Architecture <ul><li>Evolution: </li></ul><ul><ul><li>Charles Babbage:  </li></ul></ul><ul><ul><ul><li>Analytical...
Computer Architecture <ul><li>Computers of Today: </li></ul><ul><ul><li>“ It is evident that the machine must be capable o...
Computer Hardware <ul><li>Components of a simple personal computer </li></ul>Monitor Bus
CPU <ul><li>Brain of the computer </li></ul><ul><ul><li>ALU (Arithmetical- Logical Unit) </li></ul></ul><ul><ul><li>CU (Co...
CPU <ul><li>//Assembly language that does a = b + c </li></ul><ul><li>load R3, b  // Copy the value of b from memory to R3...
CPU <ul><li>Registers hold key variables and temporary results </li></ul><ul><li>They are faster to access than the main m...
Registers and OS <ul><li>OS should be aware of the registers that keep the current state of a running program </li></ul><u...
CPU Modes <ul><li>A bit in PSW controls the mode </li></ul><ul><li>Kernel (supervisor) Mode  : </li></ul><ul><ul><li>CPU c...
trap Mode (supervisor/user) S Trap Table Trusted code USER SUPERVISOR
Pipelining <ul><li>Parallelize the fetch, decode, execute sequence </li></ul><ul><li>Three stage pipeline : While executin...
Computer Hardware Review (2) <ul><li>(a) A three-stage pipeline (three instructions processed in 1 cycle) </li></ul><ul><l...
Pipelining Instruction N+2 Instruction N+3 Instruction N + 4 One CPU Cycle Instruction N + 1 Instruction N Fetch N Decode ...
Memory Hierarchy <ul><li>Magnetic Tape :  </li></ul><ul><ul><li>backup purposes  and for storing very large data sets. </l...
Memory Hierarchy <ul><li>Magnetic disks: </li></ul><ul><ul><li>are faster than tapes and CDs </li></ul></ul><ul><ul><li>Th...
Computer Hardware Review (4) Structure of a disk drive
Disk Structure Picture is from : http://www.jegsworks.com/Lessons/lesson6/lesson6-3.htm A surface with 3 tracks <ul><li>Tr...
Disk Structure Picture is from : http://www.jegsworks.com/Lessons/lesson6/lesson6-3.htm <ul><li>A track consists of a set ...
Disk Structure Picture is from : http://www.jegsworks.com/Lessons/lesson6/lesson6-3.htm <ul><li>Cylinder is the collection...
Disk Access <ul><li>Data Transfer Rate (DTR) : The rate at which bits are read from disk and sent to the controller </li><...
Disk Formatting <ul><li>Low Level formatting : dividing the disk into tracks and sectors (usually Hard Disks are already f...
DiskCapacity <ul><li>Depends on: </li></ul><ul><ul><li>Number of sides used, </li></ul></ul><ul><ul><li>How close the bits...
File System <ul><li>File system enables us to store and access data on various storage systems </li></ul><ul><ul><li>FAT16...
Memory Hierarchy <ul><li>Disks and tapes are mechanical devices, therefore they are slow compared to (RAM and Cache) </li>...
Memory Hierarchy <ul><li>Registers </li></ul><ul><ul><li>They are the fastest accessible memory locations </li></ul></ul><...
Memory Hierarchy <ul><li>Read Only Memory (ROM) </li></ul><ul><ul><li>Write once, read many times </li></ul></ul><ul><ul><...
Memory Hierarchy <ul><li>CMOS (Complementary Metal Oxide Semiconductor) </li></ul><ul><ul><li>Volatile but can be sustaine...
Yet another famous quote! <ul><li>&quot;640K ought to be enough for anybody.&quot;  </li></ul><ul><ul><li>Bill Gates, 1981...
Computer Hardware Review (3) <ul><li>Typical memory hierarchy </li></ul><ul><ul><li>numbers shown are rough approximations...
Moore’s Law <ul><li>The figures in the previous slide reflect the state of year 2001, and typical numbers change every yea...
Main Memory <ul><li>It is a sequence of subcells </li></ul><ul><li>Each subcell can store only two values, 0, or 1 (one bi...
Compiling, Linking and Loading <ul><li>Each processor has a set of predefined instructions that it can understand </li></u...
Multi programming <ul><li>A program needs to be loaded into main memory before it can be executed </li></ul><ul><li>Multip...
Multi programming <ul><li>Base register points to the start of the program text </li></ul><ul><li>Limit register tells how...
Computer Hardware Review (5) <ul><li>One base-limit pair and two base-limit pairs </li></ul>
I/O Devices <ul><li>An input device transfers data from a mechanism  like keyboard, mouse, touch screen, or microphone int...
CPU DISK CONTROLLER DISK PRINTER PRINTER CONTROLLER MEMORY MEMORY CONTROLLER <ul><li>Device controllers have microprocesso...
Interrupts <ul><li>Once a device is started by the device driver, the application can not proceed until the operation is c...
Interrupts <ul><li>An interrupt request flag  is added to CPU and control unit checks this flag during each fetch-execute ...
Computer Hardware Review (6) (a) Steps in starting an I/O device and getting interrupt (b) How the CPU is interrupted (a) ...
Upcoming SlideShare
Loading in...5
×

2005_Fall_CS307_Lecture_1.ppt

378

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
378
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

2005_Fall_CS307_Lecture_1.ppt

  1. 1. Introduction to Operating Systems Y ücel Saygın | Some of these slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum
  2. 2. Early Computers <ul><li>Charles Babbage (1791-1871) designed the first true digital computer called the analytical engine. </li></ul><ul><li>That was purely mechanical and intended to do math operations </li></ul><ul><li>The engine was supposed to be made of brass, and steam powered </li></ul><ul><li>He did not actually built the machine but inspired others in the field. </li></ul>
  3. 3. Early Computers <ul><li>Babbage also thought of the concept of software </li></ul><ul><li>And hired the first programmer (Lady Ada, Countess of Lovelace) for his analytical machine </li></ul>
  4. 4. Current Computer Systems <ul><li>A computer system consists of </li></ul><ul><ul><li>hardware </li></ul></ul><ul><ul><li>system programs </li></ul></ul><ul><ul><li>application programs </li></ul></ul>
  5. 5. What is an Operating System <ul><li>It is the software that enables us the use the hardware </li></ul><ul><li>It is a resource manager </li></ul><ul><ul><li>Allocates system resources such as I/O devices, CPU etc </li></ul></ul><ul><ul><li>Schedules different jobs etc </li></ul></ul>
  6. 6. History of Computing http://www.computerhistory.org/ <ul><li>Hewlett Packard was founded in 1939 by  David Packard and Bill Hewlett, </li></ul><ul><li>Their first product, the HP 200A Audio Oscillator </li></ul><ul><li>Walt Disney Pictures ordered eight of the 200B model to use during the creation of the movie “Fantasia.” </li></ul>
  7. 7. History of Computing http://www.computerhistory.org/ <ul><li>Computer wars: </li></ul><ul><ul><li>Germany vs Britain </li></ul></ul>Alan Turing: The bombe Konrad Zuse: Zuse Z3
  8. 8. History of Operating Systems (2) <ul><li>First generation 1945 - 1955 </li></ul><ul><ul><li>vacuum tubes, plug boards </li></ul></ul><ul><ul><li>Still very slow and used for scientific calculations </li></ul></ul><ul><li>No OS was needed </li></ul><ul><li>Programs were entered by setting some switches </li></ul>
  9. 9. A Famous Remark! <ul><li>&quot;I think there is a world market for maybe five computers.&quot; </li></ul><ul><ul><li>Thomas Watson, chairman of IBM - 1943 </li></ul></ul>
  10. 10. History of Operating Systems (2) <ul><li>Second generation 1955 – 1965 </li></ul><ul><ul><li>transistors, batch systems </li></ul></ul><ul><ul><li>Universities started to buy computers (spending millions of dollars) </li></ul></ul><ul><ul><li>Punched cards were used </li></ul></ul><ul><ul><li>To run a job (a program or a set of related programs) first punch it and give the deck to the operators and wait for the output (batch operation) </li></ul></ul><ul><ul><li>Computers were single user </li></ul></ul>IBM STRETCH DEC PDP-1
  11. 11. History of Operating Systems (3) <ul><li>Structure of a typical Fortran Monitoring System job – a 2 nd generation operating system </li></ul><ul><li>$JOB card specifies: </li></ul><ul><ul><li>the max runtime in minutes </li></ul></ul><ul><ul><li>The account number to be charged </li></ul></ul><ul><ul><li>The programmers name </li></ul></ul><ul><li>$FORTRAN card: tells the operating </li></ul><ul><li>System to load Fortran compiler </li></ul><ul><li>$RUN means run the program with </li></ul><ul><li>The following data </li></ul><ul><li>$END end of job </li></ul>
  12. 12. History of Operating Systems (1) <ul><li>Early batch system </li></ul><ul><ul><li>bring cards to IBM 1401 machine (good at card reading) </li></ul></ul><ul><ul><li>read cards to tape </li></ul></ul><ul><ul><li>put tape on IBM 7094 which does computing </li></ul></ul><ul><ul><li>put tape on IBM 1401 which prints output offline </li></ul></ul>
  13. 13. Famous Remarks <ul><li>&quot;I have traveled the length and breadth of this country and talked with the best people, and I can assure you that data processing is a fad that won't last out the year.“ </li></ul><ul><ul><li>The editor in charge of business books for Prentice Hall - 1957 </li></ul></ul>
  14. 14. History of Operating Systems <ul><li>Third generation 1965 – 1980 </li></ul><ul><ul><li>Integrated Circuits </li></ul></ul><ul><ul><ul><li>Engineer at the Advanced Computing Systems Division of IBM, 1968, commenting on the microchip </li></ul></ul></ul><ul><ul><ul><li>&quot;But what ... is it good for?&quot; </li></ul></ul></ul>
  15. 15. History of Operating Systems <ul><li>Third generation 1965 – 1980 </li></ul><ul><ul><li>Integrated Circuits and multiprogramming </li></ul></ul><ul><ul><li>IBM’s System/360 mainframe computer with a standard architecture designed to handle both scientific and commercial computing </li></ul></ul>
  16. 16. History of Operating Systems <ul><li>Third generation 1965 – 1980 </li></ul><ul><ul><li>OS/360 was the operating system of System/360 </li></ul></ul><ul><ul><ul><li>First the single task “Primary Control Program” was introduced </li></ul></ul></ul><ul><ul><ul><li>Then “Multiprogramming with a Fixed number of Tasks” </li></ul></ul></ul><ul><ul><ul><li>Finally “Multiprogramming with a Variable number of Tasks” </li></ul></ul></ul><ul><ul><li>In multiprogramming , multiple jobs are in the memory and when a job finishes another can start immediately while the free memory partition is being reloaded </li></ul></ul>
  17. 17. History of Operating Systems (4) <ul><li>Multiprogramming system </li></ul><ul><ul><li>three jobs in memory – 3 rd generation </li></ul></ul>
  18. 18. History of Operating Systems (4) <ul><li>The concept of spooling was introduced by 3 rd generation operating systems </li></ul><ul><ul><li>They loaded the programs from cards to disk, and whenever a job is finished and a memory partition was available, it is loaded directly to memory. </li></ul></ul><ul><li>Third generation OSs were still not interactive, i.e., whenever there is an error, programmers would realize it after a couple of hours. </li></ul><ul><li>This problem lead to timesharing systems where the user has an online terminal </li></ul>
  19. 19. History of OS <ul><li>MULTICS, another third generation OS introduced the concept of client server computing and influenced other OS </li></ul><ul><li>MULTICS (father of all modern OS) led to the development of UNIX </li></ul><ul><li>UNIX (1970, ATT) became popular with companies and government agencies, and people started to develop their own UNIX OS </li></ul><ul><li>IEEE developed a standard for UNIX, called POSIX to prevent chaos. </li></ul><ul><li>POSIX defined a standard set of system call interface that conformant UNIX systems should support. </li></ul>
  20. 20. History of OS <ul><li>Tanenbaum wrote a version of UNIX called MINIX with POSIX support for educational use. </li></ul><ul><li>A Finnish student Linus Torvalds wrote a free production of MINIX called Linux </li></ul>
  21. 21. History of Operating Systems (4) <ul><li>Fourth generation 1980 – present </li></ul><ul><ul><li>personal computers were developed after LSI (Large Scale Integration) circuits were invented. </li></ul></ul><ul><ul><li>First Microcomputer: </li></ul></ul><ul><ul><ul><li>Intel 8080 CPU + attached 8-inch floppy disk </li></ul></ul></ul><ul><ul><ul><li>First disk based OS CP/M (Control Program for Microcomputers) </li></ul></ul></ul><ul><ul><li>In 1980s IBM designed the IBM PC and contacted Bill Gates for an operating System </li></ul></ul>
  22. 22. Famous Remark <ul><li>“ There is no reason anyone would want a computer in their home.“ </li></ul><ul><ul><li>Ken Olson, president, chairman and founder of Digital Equipment Corp. - 1977 </li></ul></ul>
  23. 23. History of Operating Systems (4) <ul><li>Bill Gates suggested IBM that they should look at CP/M (one of the the most successful OS for microcomputers at that time, by Gary Kildall) </li></ul><ul><li>The biggest mistake of all: </li></ul><ul><ul><li>Kindall refused to sign a non-disclosure agreement </li></ul></ul><ul><li>IBM went back to Bill Gates and signed a contract with him to write an OS for their new home computer </li></ul><ul><li>MS-DOS was based on QDOS, the &quot;Quick and Dirty Operating System&quot; written by Tim Paterson of Seattle Computer Products, </li></ul><ul><li>QDOS was based on Gary Kildall's CP/M </li></ul><ul><li>Microsoft bought the rights to QDOS for $50,000 </li></ul>
  24. 24. History of Operating Systems (4) <ul><li>Early MS-DOS was very primitive but later versions included advanced features taken from UNIX </li></ul><ul><li>The early OS for microcomputers were based on users typing in commands from the keyboard </li></ul><ul><li>Doug Engelbart from SRI invented the Graphical User Interface (GUI) with windows, icons, menus, and mouse. </li></ul>
  25. 25. Famous Remark <ul><li>“ We don't see Windows as a long-term graphical interface for the masses.“ </li></ul><ul><ul><li>A Lotus Software Development official, while demonstrating a new DOS version - 1989 </li></ul></ul>
  26. 26. History of Operating Systems (4) <ul><li>Steve Jobs saw the value of GUI in a PC and developed the Apple computer with GUI (Apple Macintosh) in his garage. </li></ul><ul><li>He is also the co - founder of Pixar which has created very successful animated films: Toy Story ; A Bug's Life; Toy Story 2; Finding Nemo; Monsters. </li></ul>
  27. 27. History of Operating Systems (4) <ul><li>Microsoft developed a GUI-based system called Windows which originally ran on top of MS-DOS (just as a GUI to DOS) </li></ul><ul><li>Windows 95 and 98 were real GUI based operating systems still based on 16 bit Intel assembly language </li></ul><ul><li>Windows NT is 32-bit rewrite from scratch version of Windows 98. </li></ul><ul><li>Windows 2000 (Windows NT version 5.0), Windows Me. </li></ul>
  28. 28. Interesting TV Series <ul><li>Pirates of Silicon Valley </li></ul><ul><ul><li>Available in information center as VHS </li></ul></ul>
  29. 29. The Operating System Zoo <ul><li>Mainframe operating systems </li></ul><ul><ul><li>Room-size computers </li></ul></ul><ul><ul><li>High I/O capacity </li></ul></ul><ul><ul><li>Offers: </li></ul></ul><ul><ul><ul><li>batch processing (no interaction, such as large reports) </li></ul></ul></ul><ul><ul><ul><li>Transaction processing (small requests) </li></ul></ul></ul><ul><ul><ul><li>Timesharing (multiple users sitting in front of clients) </li></ul></ul></ul>
  30. 30. Famous Forcast <ul><li>&quot;Computers in the future may weigh no more than 1.5 tons.&quot; – </li></ul><ul><ul><li>Popular Mechanics, forecasting the relentless march of science, 1949 </li></ul></ul>
  31. 31. The Operating System Zoo <ul><li>Server operating systems </li></ul><ul><ul><li>Offer services like print, file, or web </li></ul></ul><ul><ul><li>UNIX, Windows 2000, Linux </li></ul></ul><ul><li>Multiprocessor operating systems </li></ul><ul><ul><li>Parallel computing </li></ul></ul><ul><li>Personal computer operating systems </li></ul><ul><ul><li>Single user with a good GUI, such as Windows 98, Windows 2000, Macintosh OS, Linux </li></ul></ul>
  32. 32. The Operating System Zoo <ul><li>Real-time operating systems </li></ul><ul><ul><li>E.g. industrial process control systems where each job must be completed in the specified time. </li></ul></ul><ul><ul><li>Hard real-time (nuclear reactor control systems) or soft-real time systems (e.g multimedia systems) depending on the acceptance of missing deadlines </li></ul></ul><ul><li>Embedded operating systems: </li></ul><ul><ul><li>Real-time systems with some resource constraints like memory, CPU, power. </li></ul></ul><ul><li>Smart card operating systems </li></ul><ul><ul><li>Extremely primitive OS running on credit card sized devices with a CPU. </li></ul></ul>
  33. 33. Computer Architecture <ul><li>Evolution: </li></ul><ul><ul><li>Charles Babbage: </li></ul></ul><ul><ul><ul><li>Difference Engine, automatically calculated the logarithmic tables etc </li></ul></ul></ul><ul><ul><ul><li>He did not implement it cause he found another idea, the analytical engine </li></ul></ul></ul><ul><ul><ul><li>His difference engine was reconstructed from his drawings in 1990s by a team at London Science Museum from iron, bronze and steel, consisting of 4000 components, and weighing 3 tons </li></ul></ul></ul><ul><ul><ul><li>performed its first sequence of calculations in the early 1990's and returned results to 31 digits of accuracy, </li></ul></ul></ul><ul><ul><ul><li>But, each calculation requires the user to turn a crank hundreds, sometimes thousands of times ( body building while running a program ) </li></ul></ul></ul>
  34. 34. Computer Architecture <ul><li>Evolution: </li></ul><ul><ul><li>Charles Babbage: </li></ul></ul><ul><ul><ul><li>Analytical Steam Engine (intended to work with steam power) </li></ul></ul></ul><ul><ul><ul><li>was intended to use loops to control an automatic calculator, which could make decisions based on the results of previous computations. </li></ul></ul></ul><ul><ul><ul><li>This machine was also intended to employ several features subsequently used in modern computers, including sequential control, branching, and looping. </li></ul></ul></ul><ul><ul><ul><li>was never completed cause he would come up with another idea to improve his machine </li></ul></ul></ul>
  35. 35. Computer Architecture <ul><li>Computers of Today: </li></ul><ul><ul><li>“ It is evident that the machine must be capable of storing in some manner not only the digital information needed in a given computation…, but also the instructions which govern the actual routines to be performed on the numerical data” </li></ul></ul><ul><ul><li>Von Neumann computer architecture </li></ul></ul><ul><ul><ul><li>Based on the idea that the machine has a fixed set of electronic parts whose actions are determined by a variable program </li></ul></ul></ul><ul><ul><li>Hardware in Von Neumann computer </li></ul></ul><ul><ul><ul><li>CPU (Arithmetic Logic Unit + Control Unit) </li></ul></ul></ul><ul><ul><ul><li>Memory Unit </li></ul></ul></ul><ul><ul><ul><li>I/O Devices </li></ul></ul></ul><ul><ul><ul><li>Busses to interconnect the other components </li></ul></ul></ul>
  36. 36. Computer Hardware <ul><li>Components of a simple personal computer </li></ul>Monitor Bus
  37. 37. CPU <ul><li>Brain of the computer </li></ul><ul><ul><li>ALU (Arithmetical- Logical Unit) </li></ul></ul><ul><ul><li>CU (Control Unit, fetch-execute-decode instructions) </li></ul></ul><ul><li>Has a certain set of instructions it can recognize and execute </li></ul><ul><li>Basic CPU cycle </li></ul><ul><ul><li>Fetch the next instruction </li></ul></ul><ul><ul><li>Decode it to determine its type and operands </li></ul></ul><ul><ul><li>Execute it </li></ul></ul><ul><ul><li>… .. </li></ul></ul><ul><li>Programs are list of instructions executed by the CPU </li></ul><ul><li>When the computer powers up, CU of CPU starts the fetch-decode-execute cycle </li></ul><ul><li>Instructions may be OS instructions or other programs </li></ul>
  38. 38. CPU <ul><li>//Assembly language that does a = b + c </li></ul><ul><li>load R3, b // Copy the value of b from memory to R3 </li></ul><ul><li>load R4, c // Copy the value for c from memory to R4 </li></ul><ul><li>Add R3, R4 // sum placed in R3 </li></ul><ul><li>Store R3, a // store the sum into memory cell a </li></ul>Decode Unit PC Exec Unit Fetch Unit IR 3054 Load R4, c 3046 3050 3054 3058 Main Memory 0100101111…10
  39. 39. CPU <ul><li>Registers hold key variables and temporary results </li></ul><ul><li>They are faster to access than the main memory </li></ul><ul><li>Special Registers: </li></ul><ul><ul><li>Program Counter contains the memory address of the next instruction to be fetched </li></ul></ul><ul><ul><li>Instruction Register contains the current instruction </li></ul></ul><ul><ul><li>Stack pointer points to the top of the current stack in memory </li></ul></ul><ul><ul><li>Program status word contains condition bits set by comparison instructions, and control bits </li></ul></ul><ul><li>Instructions are about loading an instruction to registers and manipulating the registers and memory locations </li></ul>Program Counter Registers Stack Pointer Program Stat Word General Register1 General Register 2
  40. 40. Registers and OS <ul><li>OS should be aware of the registers that keep the current state of a running program </li></ul><ul><li>When OS stops running a program it should save all the registers to restore the current state of the program later on </li></ul>
  41. 41. CPU Modes <ul><li>A bit in PSW controls the mode </li></ul><ul><li>Kernel (supervisor) Mode : </li></ul><ul><ul><li>CPU can execute every instruction in its instruction set </li></ul></ul><ul><ul><li>CPU can use every feature of the hardware </li></ul></ul><ul><ul><li>OS runs in kernel mode </li></ul></ul><ul><li>User Mode : </li></ul><ul><ul><li>Only a subset of instructions can be run </li></ul></ul><ul><ul><li>And a subset of hardware features are accessed </li></ul></ul><ul><ul><li>Generally all instructions involving I/O and Memory protection are disallowed in that mode </li></ul></ul><ul><li>To obtain OS services, a user program must make a system call that traps into kernel mode and invokes the OS </li></ul><ul><li>Trap instruction switches from user mode to kernel mode and starts the operating system (system calls and errors such as division by zero causes trap instructions) </li></ul>
  42. 42. trap Mode (supervisor/user) S Trap Table Trusted code USER SUPERVISOR
  43. 43. Pipelining <ul><li>Parallelize the fetch, decode, execute sequence </li></ul><ul><li>Three stage pipeline : While executing instruction N, decode instruction N+1, and fetch instruction N+2 </li></ul><ul><li>What happens when a conditional branch occurs in an instruction? </li></ul>
  44. 44. Computer Hardware Review (2) <ul><li>(a) A three-stage pipeline (three instructions processed in 1 cycle) </li></ul><ul><li>(b) A superscalar CPU (with multiple execution units) </li></ul>
  45. 45. Pipelining Instruction N+2 Instruction N+3 Instruction N + 4 One CPU Cycle Instruction N + 1 Instruction N Fetch N Decode N Fetch N+1 Execute N Decode N+1 Fetch N+2 Execute N+1 Decode N+2 Fetch N+3 Execute N+2 Decode N+3 Fetch N+4
  46. 46. Memory Hierarchy <ul><li>Magnetic Tape : </li></ul><ul><ul><li>backup purposes and for storing very large data sets. </li></ul></ul><ul><ul><li>One dimensional, only sequential access is possible </li></ul></ul><ul><ul><li>Reliable (no tape crashes, or time based data corruption) </li></ul></ul><ul><ul><li>Was the main data storage medium of the past </li></ul></ul><ul><li>Optic CDs: </li></ul><ul><ul><li>Faster than tape </li></ul></ul><ul><ul><li>Used for permanent storage (now rewritable) </li></ul></ul>
  47. 47. Memory Hierarchy <ul><li>Magnetic disks: </li></ul><ul><ul><li>are faster than tapes and CDs </li></ul></ul><ul><ul><li>They are the main storage medium these days </li></ul></ul><ul><ul><li>Data stored in concentric cylinders </li></ul></ul><ul><ul><li>Disk head moves in discrete steps </li></ul></ul><ul><ul><li>Each position of the disk head identifies a track (divided into multiple sectors, typically 512 bytes) </li></ul></ul><ul><ul><li>Rotates continuously with a certain speed (e.g. 10000 rpm) </li></ul></ul>
  48. 48. Computer Hardware Review (4) Structure of a disk drive
  49. 49. Disk Structure Picture is from : http://www.jegsworks.com/Lessons/lesson6/lesson6-3.htm A surface with 3 tracks <ul><li>Track is a sequence of bits on a circular region on the surface of the plate </li></ul>
  50. 50. Disk Structure Picture is from : http://www.jegsworks.com/Lessons/lesson6/lesson6-3.htm <ul><li>A track consists of a set of sectors defined with a magnetic marking and and ID number </li></ul><ul><li>Cluster is a collection of sectors </li></ul>
  51. 51. Disk Structure Picture is from : http://www.jegsworks.com/Lessons/lesson6/lesson6-3.htm <ul><li>Cylinder is the collection of tracks with the same radius </li></ul><ul><li>Addressing : 1) CHS (Cylinder-head-sector) used in most IDE drives </li></ul><ul><li>2) LBA (Logical Block Address) used in </li></ul><ul><li>SCSI and advanced IDE drives </li></ul><ul><li>Disk Cache (Buffer) : Frequently used data is stored in the RAM of the Hard Disk to improve read performance </li></ul>
  52. 52. Disk Access <ul><li>Data Transfer Rate (DTR) : The rate at which bits are read from disk and sent to the controller </li></ul><ul><li>Rotational Latency: The avg time to locate a bit on a track </li></ul><ul><li>Seek time : Avg time for locating the track </li></ul>
  53. 53. Disk Formatting <ul><li>Low Level formatting : dividing the disk into tracks and sectors (usually Hard Disks are already formatted) </li></ul><ul><li>Partitioning </li></ul><ul><ul><li>divides the disk drive into logical drives (C: D: E:) (using fdisk command in DOS) </li></ul></ul><ul><ul><li>Every disk drive has a primary partition (say C:) plus some extended partitions </li></ul></ul><ul><li>High Level Formatting : Preparing drive partitions for the OS by creating a root directory, creating a FAT etc. </li></ul>
  54. 54. DiskCapacity <ul><li>Depends on: </li></ul><ul><ul><li>Number of sides used, </li></ul></ul><ul><ul><li>How close the bits are (denser the better) </li></ul></ul><ul><ul><li>Number of tracks on disk </li></ul></ul><ul><li>2. And 3. determine the bits/square-inch </li></ul><ul><li>Early hard disks were 40 MB </li></ul><ul><li>Nowadays hundreds of GB </li></ul>
  55. 55. File System <ul><li>File system enables us to store and access data on various storage systems </li></ul><ul><ul><li>FAT16 (DOS and Windows 3.x) </li></ul></ul><ul><ul><li>FAT32 (Windows95 and higher, FAT16 can be converted to FAT32 ) </li></ul></ul><ul><ul><li>NTFS (Windows NT, not compatible with FAT16 or FAT32) </li></ul></ul><ul><li>Disk is addresses by clusters (collection of sectors, ex: 512x4 bytes, can be more for larger disks) </li></ul>
  56. 56. Memory Hierarchy <ul><li>Disks and tapes are mechanical devices, therefore they are slow compared to (RAM and Cache) </li></ul><ul><li>Main Memory (Random Access Memory) : </li></ul><ul><ul><li>Volatile </li></ul></ul><ul><ul><li>Much Much faster than magnetic disks but more expensive too </li></ul></ul><ul><li>Cache: </li></ul><ul><ul><li>Faster than RAM and more expensive </li></ul></ul><ul><ul><li>CPU requests first go to cache, and if they are there (cache hit) then fine, if not there (cache miss) then RAM is accessed </li></ul></ul><ul><ul><li>There can be multiple cache levels </li></ul></ul><ul><ul><li>Cache is divided into cache lines (usually 64 bytes at each line) </li></ul></ul>
  57. 57. Memory Hierarchy <ul><li>Registers </li></ul><ul><ul><li>They are the fastest accessible memory locations </li></ul></ul><ul><ul><li>Placed at the CPU. </li></ul></ul><ul><ul><li>They are usually of size 32 bits, or 64 bits depending on the CPU type </li></ul></ul>
  58. 58. Memory Hierarchy <ul><li>Read Only Memory (ROM) </li></ul><ul><ul><li>Write once, read many times </li></ul></ul><ul><ul><li>Low level I/O cards </li></ul></ul><ul><ul><li>Code for starting the computer </li></ul></ul><ul><li>Electrically Erasable Rom (EEPROM) </li></ul><ul><ul><li>Non volatile </li></ul></ul><ul><li>Flash RAM </li></ul><ul><ul><li>Non volatile </li></ul></ul>
  59. 59. Memory Hierarchy <ul><li>CMOS (Complementary Metal Oxide Semiconductor) </li></ul><ul><ul><li>Volatile but can be sustained with mother board battery for years. </li></ul></ul><ul><ul><li>May give checksum errors when being corrupted </li></ul></ul><ul><ul><li>Very small, 64 bytes. </li></ul></ul><ul><ul><li>Holds the current time and date, configuration parameters (like which disk to boot from etc.) </li></ul></ul>
  60. 60. Yet another famous quote! <ul><li>&quot;640K ought to be enough for anybody.&quot; </li></ul><ul><ul><li>Bill Gates, 1981 </li></ul></ul>
  61. 61. Computer Hardware Review (3) <ul><li>Typical memory hierarchy </li></ul><ul><ul><li>numbers shown are rough approximations </li></ul></ul>
  62. 62. Moore’s Law <ul><li>The figures in the previous slide reflect the state of year 2001, and typical numbers change every year. </li></ul><ul><li>In General Moore’s Law: </li></ul><ul><ul><li>The observation made in 1965 by Gordon Moore (co-founder of Intel) </li></ul></ul><ul><ul><li>He observed that the number of transistors per square inch on integrated circuits had doubled every year since the integrated circuit was invented. </li></ul></ul><ul><ul><li>He predicted that this will continue for the near future. </li></ul></ul><ul><ul><li>The pace slowed down a little to 18 months (instead of 12) and this is the current definition of Moore's Law, </li></ul></ul><ul><ul><li>Most experts expect Moore's Law to hold for at least another two decades. </li></ul></ul>
  63. 63. Main Memory <ul><li>It is a sequence of subcells </li></ul><ul><li>Each subcell can store only two values, 0, or 1 (one bit) </li></ul><ul><li>8 subcells (bits) is a cell = 1 byte </li></ul><ul><li>divided into words (of size 2 or 4 bytes) </li></ul><ul><li>Byte addressible </li></ul>
  64. 64. Compiling, Linking and Loading <ul><li>Each processor has a set of predefined instructions that it can understand </li></ul><ul><ul><li>Ex (Intel 8088) : C7 C0 C5 9A </li></ul></ul><ul><ul><li>This tells the processor to load register AX with data 9AC </li></ul></ul><ul><li>Assembly language defines a set of symbolic instructions instead of OpCodes (like C7) </li></ul><ul><ul><li>Ex (Intel 8088) : MOV AX, 9AC5H </li></ul></ul><ul><ul><li>Load register AX with data 9AC5 (written in Hexadecimal format) </li></ul></ul><ul><li>The programs that you write are too high level </li></ul><ul><li>A program needs to be compiled into a sequence of instructions (Machine Language) </li></ul><ul><li>Machine Language can be directly fetched, decoded and executed by the CPU </li></ul>
  65. 65. Multi programming <ul><li>A program needs to be loaded into main memory before it can be executed </li></ul><ul><li>Multiple programs in RAM </li></ul><ul><li>Problems: </li></ul><ul><ul><li>How to protect programs from one another? </li></ul></ul><ul><ul><li>How to handle relocation? </li></ul></ul><ul><ul><ul><li>We do not know which MM location the program will be loaded </li></ul></ul></ul><ul><ul><ul><li>We need to handle the addresses referenced in the program </li></ul></ul></ul><ul><li>Solution </li></ul><ul><ul><li>Modify all addresses when loading (X) </li></ul></ul><ul><ul><li>Do it on-the-fly during execution (X) </li></ul></ul><ul><ul><li>Use base and limit registers (++) </li></ul></ul>
  66. 66. Multi programming <ul><li>Base register points to the start of the program text </li></ul><ul><li>Limit register tells how large the combined program and data are </li></ul><ul><li>When an instruction is to be fetched: </li></ul><ul><ul><li>Hardware checks to see if the PC (program counter) is less than the limit register </li></ul></ul><ul><ul><li>If so adds it to the base register and sends the sum the the Main Memory. </li></ul></ul><ul><ul><li>Base register contents are added to every memory address reference, so program can not reference the memory below base register </li></ul></ul><ul><ul><li>Limit register makes it impossible to reference locations above it </li></ul></ul><ul><li>Both Protection and Relocation problems are solved with base and limit registers </li></ul>
  67. 67. Computer Hardware Review (5) <ul><li>One base-limit pair and two base-limit pairs </li></ul>
  68. 68. I/O Devices <ul><li>An input device transfers data from a mechanism like keyboard, mouse, touch screen, or microphone into a CPU register </li></ul><ul><li>CPU will then store the data into Main Memory </li></ul><ul><li>For Output devices, CPU fetches the information from main memory to its registers and transfers this information via the bus to an output device like screen, speaker, or printer. </li></ul><ul><li>Communication devices : serial and parallel ports, infrared transmitter/receivers, wireless network cards, network interface cards </li></ul>
  69. 69. CPU DISK CONTROLLER DISK PRINTER PRINTER CONTROLLER MEMORY MEMORY CONTROLLER <ul><li>Device controllers have microprocessors, </li></ul><ul><li>They can work in parallel. </li></ul><ul><li>They can read/write devices and memory in parallel. </li></ul><ul><li>They can tell CPU when they are done. </li></ul>
  70. 70. Interrupts <ul><li>Once a device is started by the device driver, the application can not proceed until the operation is complete </li></ul><ul><li>The Device driver can do: </li></ul><ul><ul><li>Polling and busy-waiting (continuously checking the flags of the device) </li></ul></ul><ul><ul><li>Or the device can signal the CPU when it has finished its job </li></ul></ul>
  71. 71. Interrupts <ul><li>An interrupt request flag is added to CPU and control unit checks this flag during each fetch-execute cycle. </li></ul><ul><li>All the device done flags are connected to the interrupt request flag using OR logic. </li></ul><ul><li>When a “done” flag is set for any device, then the interrupt request flag is also set informing the control unit of CPU </li></ul>
  72. 72. Computer Hardware Review (6) (a) Steps in starting an I/O device and getting interrupt (b) How the CPU is interrupted (a) (b)
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×