1 / 23

CSCE451/851

CSCE451/851. Introduction to Operating Systems http://cse.unl.edu/~ylu/csce451 https://piazza.com/unl/fall2017/csce451/home. Chapter 1 -Introduction. What is an operating system? Interface between application programs and hardware Basic purpose of an operating system?

rsearcy
Download Presentation

CSCE451/851

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCE451/851 • Introduction to Operating Systems • http://cse.unl.edu/~ylu/csce451 • https://piazza.com/unl/fall2017/csce451/home

  2. Chapter 1 -Introduction • What is an operating system? • Interface between application programs and hardware • Basic purpose of an operating system? • Provide services to application programs • Control functioning of hardware • From a user’s point of view • Ease of use <-> maximize work (or play) that user performs • From a system’s point of view • Resource allocator

  3. user1 user2 user n editor ie calc appx Components of a Computer System hardware Operating System applications

  4. 1.2 Computer System Organization • Most (if not all) modern CPU design is based on interrupts • The CPU has various lines thru which a signal can be sent (interrupt) • Interrupts can originate from hardware, cpu(trap), software(system call) • Interrupts are provided as a way to improve processor performance • Hardware interrupts can happen very frequently and must be handled promptly and efficiently

  5. Handling an Interrupt • Interrupt vector – an array of pointers to interrupt service routines indexed by the interrupt number • When the CPU is interrupted: • CPU saves address of interrupted instruction • Invokes interrupt service routine whose address is stored in the Interrupt vector • After the interrupt is serviced, the saved instruction address (and state) is restored and CPU resumes

  6. Program Flow of Control

  7. I/O Structures (1.2.3) • A large part of operating system code is dedicated to managing I/O • Reliability • Performance • Various types of devices available • I/O is achieved through synchronization between • Operating system code called device drivers • Device controllers which transfer data between hardware and internal buffers • Interrupts which invoke the correct device drivers

  8. Device Controller Interface Primary Memory .. busy done Error codes .. Instruction Data Status Cpu Data Logic Dev. Ctrlr. Data n-1 Device

  9. I/O Structures (Character I/O) • Example of slow input device-keyboard • DC loads data register and interrupts CPU • CPU invokes DD - Interrupt Vector • DD fetches data from DC data register and transfers data to memory location • Example of serial output device-printer • OS Invokes DD • DD loads data/instruction register on DC • DC interrupts CPU when its done • DD checks status registers, raises error or loads next data/instruction on DC

  10. I/O Structure – Block Devices • Character I/O is not effective enough for bulk data movement, Disks etc. • An alternative to character I/O is block I/O (DMA) • O/S sets up registers (instruction, buffer address, size etc.) in the DC • DC transfers data directly to memory, interrupts CPU only to signal completion/error

  11. XFER DATA Interrupt CPU on Completion LOAD COM., ADD. & SIZE XFER DATA GET STATUS INTERRUPT CPU LOAD COMMAND GET STATUS Interrupt I/O (Character I/O) vs. Direct Memory Access (Block I/0) Primary Memory Primary Memory Input LOAD COMMAND* INTERRUPT CPU GET STATUS Input/Output XFER DATA Cpu Cpu Output Dev. Ctrlr. Dev. Ctrlr. Device Device

  12. 1.3 Computer System Architecture • Self Read • Must know the difference between Symmetric and Asymmetric systems.

  13. The evolution of OS

  14. 1.4 Operating System Structure • Multiprogramming - keep multiple jobs in memory, switching between them when the CPU is idle. Improve utilization of computer system • Time sharing – switching between jobs based on timer • Switches between jobs very frequently • Each user/process is given the impression that they have sole access to the system OS Job 1 Job 2 Job 3 Job n

  15. Multitasking and Timesharing • First multitasking operating systems such as DOS were introduced to improve CPU efficiency • Then Time shared systems such as Unix and Windows to allow multiple “simultaneous” program execution • The O/S need to save the state of each program during interrupts, it needs to schedule the programs etc. • To support the above and other issues, the concept of a process was created (Chapter 3)

  16. 1.5 Modes of Operation • How do we prevent user processes from writing to Device Controller registers? • Most systems support at least two modes of operation: the user mode and the kernel mode

  17. Dual-Mode Operation Only User code is allowed to execute when CPU is in user mode All Operating System code is available when CPU is in Kernel mode What if a user process needs some OS service? System calls (S/C) provide the means for a user program to ask the OS to perform tasks reserved for the OS on the user program’s behalf Process Scheduler USB Device Driver Create File S/C Create Process S/C Virtual memory Mgr PCI Device Driver Read File S/C Kill Process S/C Inter Process Communication Write File S/C Signal Process S/C Locks & Synch.

  18. Dual Mode Operation • To support a stable and secure system, a dual-mode CPU was introduced • Various instructions and memory addresses could only be accessed in Kernel mode • To access service routines only available in the kernel (open a file, write a character to terminal, etc), a user process makes system calls • Interrupt handlers are invoked to handle these system calls

  19. Dual Mode Operation • A system call allows a user process to request a protected service form the operating system • The system call number along with arguments are stored in well defined registers and a special instruction is executed • The cpu is placed in kernel mode and the system call service routine is executed • The operating system determines the service the user process is requesting and verifies the arguments • When complete, results are placed in the users process space and the cpu is placed back in user mode • Execution continues with the next instruction

  20. Dual Mode Operation • The CPU is placed in kernel mode when an interrupt/trap/system call is received user mode mode bit=1 User process resume user process call sys call return mode bit = 1 mode bit = 0 kernel mode mode bit=0 Execute Sys Call

  21. The Timer • The CPU timer interrupts the CPU during predetermined intervals • Most timers are variables and can be set to interrupt the CPU after the user process has executed for a predetermined amount of time • Instructions that update the timer must be privileged instructions • Ensures that the OS maintains control of the CPU • OS always sets time before turning over control to user

  22. Other O/S Responsibilities • Discuss tasks the operating system would be responsible for each of the subsystems listed below • Memory management (Chap 1.7) • Process management (Chap 1.6) • Storage management (Chap 1.8) • Protection and Security (Chap 1.9)

  23. Reading Assignment. • By this Friday • Read Chapter 3

More Related