• Like
  • Save
Upcoming SlideShare
Loading in...5







Total Views
Views on SlideShare
Embed Views



0 Embeds 0

No embeds



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    2005_Fall_CS307_Lecture_1.ppt 2005_Fall_CS307_Lecture_1.ppt Presentation Transcript

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