Presentation is loading. Please wait.

Presentation is loading. Please wait.

Operating Systems Concepts Professor Rick Han Department of Computer Science University of Colorado at Boulder.

Similar presentations


Presentation on theme: "Operating Systems Concepts Professor Rick Han Department of Computer Science University of Colorado at Boulder."— Presentation transcript:

1 Operating Systems Concepts Professor Rick Han Department of Computer Science University of Colorado at Boulder

2 CSCI 3753 Announcements Moodle - posted Tuesday’s lecture, updated syllabus, assignment 0, check the news forum for announcements, etc. TA introduced in recitation the first programming shell assignment (similar to lab exercise 2.1) and CSEL logistics Introduction to Operating Systems Read chapters 1 and 2 in the textbook

3 Modern Operating Systems An operating system is a layer of software between many applications and diverse hardware that –helps to better manage the hardware for an application otherwise an application saving a file to disk would have to know how the disk operates –helps to share resources and isolate access to resources between multiple applications App3 Operating System DiskMemoryCPUDisplayMouse App2 App1 I/O

4 Modern Operating Systems A PC operating system consists of multiple components –scheduler –virtual memory system –file system –other... App3 DiskMemoryCPUDisplayMouse App2 App1 I/O SchedulerVM File System OS “Kernel”

5 System Libraries and Tools (Compilers, Shells, GUIs) Modern Operating Systems App3 DiskMemoryCPUDisplayMouse App2 App1 I/O SchedulerVM File System OS “Kernel” Posix, Win32, Java, C library API System call API Device Manager

6 What is an Application? A software program consist of a sequence of code instructions and data –for now, let a simple app = a program Computer executes the instructions line by line –code instructions operate on data Code Data Program P1

7 Generating a Program’s Binary Executable We program source code in a high-level language like C or Java, and use tools like compilers to create a program’s binary executable Code Program P1’s Binary Executable Source Code Compiler file P1.c AssemblerLinker Data gcc can generate any of these stages P1.s P1.o In reality, more complex - static vs. dynamic linking

8 Loading a Program into Memory Code Data Code Data Code Data P1 binary P2 binary Disk Main Memory OS Loader Program P1 binary In reality, more complex, execve sys call and paging are involved Invoked by typing program name in shell Copies P1 from disk to RAM

9 Executing a Program Code Data Main Memory Program P1 binary shift left by 2 the value in register R1 and put in address A invoke low level system call n to OS: syscall n jump to address B Machine Code instructions of binary executable

10 CPU Execution of a Program Program Counter PC points to address of next instruction to fetch Code Data Main Memory Program P1 binary CPU Program Counter Register (PC) Registers CPU fetches next instruction indicated by PC Write any output data Fetch any data needed ALU ALU = Arithmetic Logic Unit

11 Multiprogramming: Batch Processing Load program P1 into memory, called a job, and execute on CPU, running to completion Then load program P2 into memory, and run to completion –or you could have multiple programs in memory, arranged in a queue, lined up waiting for the CPU You would submit a batch job to the computer, and while the batch job was running, you could go play tennis, and then come back for the results –very non-interactive

12 Multiprogramming Main Memory Data P1 Data P2 Data P3 Time P1 Programs Executing on CPU P2 P1 P1 blocks on I/O P1 resumes P1 completes, P2 starts CPU is Idle! => Poor Utilization, Billions of Wasted Cycles

13 Multiprogramming What if Program P1 blocks waiting for something to complete? –waiting on I/O, e.g. waiting for a disk write to complete, or waiting for a packet to arrive over the radio I/O can be very slow compared to CPU speed –then CPU is idle for potentially billions of cycles! Better if CPU switches to another program P2 and begins executing P2 –better utilization of the CPU

14 Multiprogramming Main Memory Data P1 Data P2 Data P3 Time P1 Programs Executing on CPU P2 P3 P1 P1 blocks on I/O P2 blocks, P3 starts P3 completes, P1 resumes OS Scheduler Switches CPU Between Multiple Executing Programs

15 Multiprogramming CPU time-multiplexes between executable programs –programs share CPU Memory is space-multiplexed between multiple programs –programs share RAM Each program sees an abstract machine (provided by OS) –it has its own private (slower) CPU –it has its own private (smaller) memory Main Memory Data P1 Data P2 Data P3

16 Multitasking Early computers were big mainframes We’d like to share the memory and CPU of a mainframe not just between different programs or batch jobs, but also between different human users Time sharing systems were developed Give each user a very small slice of the CPU pie frequently

17 Multitasking Main Memory Data P1 Data P2 Data P3 Time P1 Programs Executing on CPU P3 finishes OS Scheduler Switches CPU Rapidly Between Multiple Executing Programs P3 P1 P2 P3 P1 P2 P1 P2

18 Multitasking Enables interactivity –In the small time slice a program is given, it can draw a character on the screen that you’ve just typed - appearance of interactivity –In old time-sharing systems, depending on the load, it may take 15 seconds for the character to appear on screen! (learned to type ahead) In time, this was applied to multiple programs on a PC’s CPU –listen to MP3’s while editing your documents - interactive multitasking

19 Operating Systems: Course Overview Chapter 3: OS Organization Chapter 4-5: Hardware/Device Management –Single application’s view: OS provides hardware abstraction Process Management –multiple application: OS provides hardware abstraction, resource sharing and isolation Memory Management File Management Security Distributed OS


Download ppt "Operating Systems Concepts Professor Rick Han Department of Computer Science University of Colorado at Boulder."

Similar presentations


Ads by Google