Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda.

Similar presentations


Presentation on theme: "1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda."— Presentation transcript:

1 1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda

2 2 Course Objective  Understand the basic principles of designing and implementing operating systems  Why study OS?  Be better developer (system and application levels)  Be better computer user  Use OS concepts in many different CS areas and courses

3 3 Course Info  Textbook  Silberschatz, Galvin, Gagne, Operating System Concepts, 7th edition, 2005. (We will refer to it as OSC)  Grading  Assignments: 30% (problem sets and programming projects)  Midterm exam: 25%  Class participation: 5%  Final exam: 40%  Web page http://nsl.cs.surrey.sfu.ca/teaching/06/300

4 4 Topics  Operating System Structures  Processes and Threads  CPU Scheduling and Process Coordination  Memory Management  Storage Management and File Systems  I/O Systems  Security and Protection (time permits)

5 5 Chapter 1: Introduction

6 6 Objectives  To provide a grand tour of the major operating systems components  To provide coverage of basic computer system organization

7 7 Computer System Structure  Computer system has four components  Hardware – provides basic computing resources CPU, memory, I/O devices  Operating system Controls and coordinates use of hardware among various applications and users  Application programs – define the ways in which the system resources are used to solve the computing problems of the users Word processors, compilers, web browsers, database systems, video games  Users People, machines, other computers

8 8 Four Components of a Computer System

9 9 Operating System Definition  OS is a program that acts as an intermediary between users and computer hardware  OS is a resource allocator  Manages all resources  Decides between conflicting requests for efficient and fair resource use  OS is a control program  Controls execution of programs to prevent errors and improper use of the computer

10 10 Operating System Goals  Make the computer system convenient to use  Execute user programs and make solving user problems easier  Use the computer hardware in an efficient manner  Note:  The one program running at all times on the computer” is the kernel  Everything else is either a system program (ships with the operating system) or an application program

11 11 Computer System Organization  One or more CPUs, device controllers connect through common bus to a shared memory

12 12 Computer System Operation  I/O devices and CPU can execute concurrently  Each device controller  is in charge of a particular device type  has a local buffer  I/O is performed from device to local buffer  CPU moves data between main memory and local buffers  Device controller informs CPU that it has finished its operation by causing an interrupt

13 13 Interrupt Handling  OS preserves state of CPU by storing registers and the program counter.  Determines which type of interrupt has occurred:  polling  vectored interrupt system (common)  The corresponding interrupt handler is called to process the interrupt

14 14 Storage Systems: Hierarchy Cost Speed  Storage systems  Speed  Cost  Volatility

15 15 Comparison of Storage Systems

16 16 Caching  Caching  Information is copied from slower to faster storage  performed at many levels in a computer (HW, OS, SW)  Faster storage (cache) checked first to determine if information is there  If it is, information used directly from the cache (fast)  If not, data copied to cache and used there

17 17 Caching Example: Migration of Integer A from Disk to Register  Movement between levels of storage hierarchy can be explicit or implicit  Multitasking environments must be careful to use most recent value, not matter where it is in the storage hierarchy  Cache consistency

18 18 Operating System Operations  OS is interrupt driven: sits idle till something happens  Interrupts are generated by hardware devices  Traps (or exceptions) are software-generated interrupts due to software errors, e.g., divide by zero Request for operating system services (system calls)  OS operates in two modes  User mode and kernel mode  Mode bit provided by hardware to indicate current mode  Some instructions designated as privileged, only executable in kernel mode  Why dual mode?  To enable OS to protect itself from users codes, and protect users from each other

19 19 Transition from User to Kernel Mode

20 20 More Protection: Timer  Timer to prevent program from holding resources (CPU) for too long, e.g., infinite loop  How it works  Before giving control to a user program, OS sets a timer to a specific value  After period expires, an interrupt is issued and OS regains control  OS then decides whether to grant more time for the program or terminate it

21 21 Multiprogramming in OS  Multiprogramming  Multiple jobs are kept in memory so that CPU always has something to execute  needed for efficiency, a single job may not keep CPU and I/O devices busy at all times  One job is selected to run via CPU scheduler  When the job has to wait (for I/O for example), OS switches to another job  Timesharing (multitasking)  CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing

22 22 Summary  OS is a layer between user and hardware to make life easier for user and use hardware efficiently  Computer organization  CPU(s), memory, and I/O devices connect to a common bus  Devices request CPU attention through interrupts  Storage hierarchy: speed, cost, volatility  Caching: copy frequently used data to faster storage  Multiprogramming: multiple jobs in memory  efficiency  Timesharing: frequently switch between jobs  interactive  Dual mode operation: user and kernel modes  Protect OS and users from each other  Privileged instructions executed only in kernel mode  Timer to prevent processes from holding resources forever


Download ppt "1 School of Computing Science Simon Fraser University CMPT 300: Operating Systems I Dr. Mohamed Hefeeda."

Similar presentations


Ads by Google