1 / 28

Operating Systems

Operating Systems. Concepts and Principles monolithic and micro kernels processes and threads their management and synchronisation interprocess communication interrupts and signals virtual memory - paging and segmentation Implementation Techniques resource allocation

Leo
Download Presentation

Operating Systems

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. Operating Systems: Intro Operating Systems • Concepts and Principles • monolithic and micro kernels • processes and threads • their management and synchronisation • interprocess communication • interrupts and signals • virtual memory - paging and segmentation • Implementation Techniques • resource allocation • time management - process scheduling • memory management - usage models and page allocation • file systems • case studies - Kops, Linux, NT etc.

  2. Operating Systems: Intro Coursework • To Be Announced • probably involving some programming • deadline - mid-term • Essay - in-depth comparison of PDA Operating Systems • structure, scheduling, memory management, security etc. • deadline - end of term Tutorials only when needed

  3. Operating Systems: Intro Textbooks • William Stallings, Operating Systems, Internals & Design Principles, 4th edition, Prentice-Hall, 2001. • Abraham Silberschatz & Peter Galvin, Operating System Concepts, 5th edition, Addison-Wesley, 1998. • Gary Nutt, Operating Systems, A Modern Perspective, 2nd edition, Addison-Wesley, 2000. • D.A.Solomon & M.E.Russinovitch, Inside Windows 2000, 3rd edition, MicroSoft Press, 2000. • D.Boling, Programming MicroSoft Windows CE, MicroSoft Press, 1998. • Michael Beck et al., Linux Kernel Internals, 2nd edition, Addison-Wesley, 1997. • John O’Gorman, Operating Systems with Linux, Palgrave, 2001.

  4. Operating Systems: Intro Motivation • An Automated Teller Machine (ATM) process • process to deposit an amount into an account: • deposit (account, amount) { • read ( account, balance ); // read balance from database • balance = balance + amount; // add deposit amount • write (account, balance ); // update database • } • process to withdraw an amount from an account: • withdraw ( account, amount ) { • read (account, balance); // read balance from database • balance = balance - amount; // subtract withdrawal amount • write ( account, balance); // update database • } • concurrent processes?

  5. Operating Systems: Intro • To sum the elements of a matrix • in row order: sum = 0; for (row=0; row<row_max; row++) { for (col=0; col<col_max; col++) { sum = sum + array[row,col]; } } cout << “Array Sum =“ << sum << endl; • in column order: sum = 0; for (col=0; col<cp;_max; col++) { for (row=0; row<row_max; row++) { sum = sum + array[row,col]; } } cout << “Array Sum =“ << sum << endl; • any difference?

  6. Operating Systems: Intro Operating Systems • Main purpose is to facilitate the execution of user application programs • bare hardware is extremely messy and difficult for users to program • processors • memory • peripheral devices • concurrency • interrupts • files • networks

  7. Operating Systems: Intro • Modern operating systems structured around concept of a process process = “program in execution” • a process is not the same as a program • programs are passive, processes are active • a process consists of an executable program, associated data and its execution context • A process runs in a framework which provides a Virtual Machine for it • a Virtual Machine is a simplified machine with: • user-level processor • virtual memory • high-level facilities • a machine with one user

  8. Operating Systems: Intro • An OS supports execution of many concurrent processes • many co-existing virtual machines • each run alternately - pseudo-concurrently • OS issues revolve around process management • how and when to create & destroy processes • how to avoid interference between processes • how to achieve cooperation between processes

  9. Operating Systems: Intro • An OS manages resource requirements of processes • time • memory • files • I/O device access • processors • An OS aims to be efficient • for user • for system manager

  10. Operating Systems: Intro • A process can be in one of several states • newly created • running • blocked • waiting for some event to occur • in main memory • moved out to disc • ready to run • terminated

  11. Operating Systems: Intro • Overheads in swapping execution between processes • saving and restoring contexts • loss of cache contents • Places limits on how often execution should be swapped • performance will plummet if too frequent

  12. Operating Systems: Intro • A relatively new mechanism to improve overheads is the Thread • a lightweight process • several threads within one process or virtual machine • much smaller context to preserve • must cooperate • must not compete • can be separately scheduled • can run concurrently on multiprocessor systems • often also a very convenient programming paradigm

  13. Operating Systems: Intro Interfaces user user user user user application application application application application process process process process process Operating System Hardware

  14. Operating Systems: Intro • Communications between OS and processes • from process to OS - system calls • from OS to process - signals

  15. Operating Systems: Intro • Communications between OS and Hardware • from OS to hardware - register & status settings • from hardware to OS - interrupts and exceptions

  16. Operating Systems: Intro • Communications between processes • signals • message passing • via buffers • shared virtual memory • pipes • sockets • Communications between users and processes • keyboard, mouse, touch-screen • bit-mapped text and graphics display screens with windows • printers, plotters

  17. Operating Systems: Intro Interrupts • An interruption in the normal execution flow of a processor • a mechanism for causing the processor to suspend its current computation and take up some new task • old context must be preserved • control can be returned to the original task at some later time • new context started • Reasons: • control of asynchronous I/O devices • exceptional conditions arising from execution

  18. Operating Systems: Intro • OS sets up an Interrupt Vector with service routine entry points • one entry per I/O device or I/O channel • a dormant context set up for each routine which can be activated on demand • further interrupts usually switched off during initial interrupt servicing • Example: Intel x86 interrupt vector entries: 0 : divide error . . . 14: page fault 32: timer 33: keyboard . . . 36: serial port 1 37: parallel port 2 38: floppy controller . . . 46: hard disc

  19. Operating Systems: Intro • An OS can be viewed as an event-driven system • just reacts to events as they occur • Interrupts need to be serviced carefully and quickly by the OS • cost similar to a process switch • too many interrupts will kill performance • Alternative to interrupts is Polling • process (or OS) continually polls I.e. inspects, device status registers awaiting some condition e.g. transfer completed • wastes time looping until condition occurs • much simpler to program than using interrupts but inefficient

  20. Operating Systems: Intro Privilege • Processors run at various levels of privilege • user-level • only the types of instruction needed by applications programs • only access to permitted areas of virtual memory • supervisor or kernel level • all types of instruction including I/O instructions • access to system registers • virtual memory registers • interrupt vectors • access to all areas of virtual memory • ability to switch interrupts on and off • may be intermediate levels on some architectures • each level may have its own processor registers to speed context switching

  21. Operating Systems: Intro What’s part of an Operating System? • Process management • Interrupt handling • Device drivers • File system • Networking • Applications? • Web browser? • Email? • Windows? • Command interpreters?

  22. Operating Systems: Intro Kinds of Operating System • For single-user workstation • For multiple-user server • file,compute, mail, web servers etc. • For mainframe systems • transaction processing • database systems • For real-time systems • time-critical applications • industrial process control • hard rather than soft deadlines

  23. Operating Systems: Intro • All built with the same concurrent multi-process organisation • Main difference is in process scheduling • single user system needs only to meet one user’s expectations • overall efficiency less important • multiple user system needs to be equitable between users • efficiency important • transaction processing system needs to give good response • database queries • real-time system may need to pre-allocate processor time to guarantee meeting deadlines • overall efficiency may need to suffer

  24. Operating Systems: Intro • Only exception to multiple-process organisation is embedded systems • dedicated single-purpose processors • multi-media, telecoms • MPEG decoders, GSM phones, portable web browsers • washing machine controllers! • avionics • FADECs, GPS, FMS • absolute reliability required • very conservatively programmed • System Level Integrated circuits • usually have a processing core which requires a real-time OS • often multiprocessors with a general-purpose CPU plus a DSP processor • ARM + OAK

  25. Operating Systems: Intro Operating System Structure • How to partition OS functions? • process management and scheduling, memory management, interrupt handling, device drivers etc. • Monolithic OS • each function coded as a separate procedure • linked into one executable code object • event-driven core which calls appropriate procedures when required • driven by interrupts and system calls from processes • Linux • modules can be dynamically linked and unlinked as required

  26. Operating Systems: Intro • Micro-kernel OS • each function coded as a separate process • system processes • only the minimum possible function in the core kernel • virtual memory organising • interrupt handling • process dispatching • appropriate system process activated as soon as possible to deal with all other functions • system processes will have higher privilege and usually higher priority than user processes • Windows NT • Intermediate flavours • some system processes but not a minimal micro-kernel

  27. Operating Systems: Intro Windows NT Structure Hardware

  28. Operating Systems: Intro • Advantages and disadvantages • monolithic: • faster switching to kernel functions • simple interfaces between functions i.e. procedure calls • easier access to data structures shared between functions • larger memory resident core • may become too large to maintain easily • micro-kernel • better partitioning - should be easier to implement and maintain • smaller memory resident core • slower switching to system processes • inter-system-process communications may be slower

More Related