Assoc. Prof. Dr. Ahmet Turan ÖZCERİT. What Operating Systems Do Computer-System Organization ...

29
Introduction to Computer Engineering WEEK-13 Operating Systems Assoc. Prof. Dr. Ahmet Turan ÖZCERİT

description

3

Transcript of Assoc. Prof. Dr. Ahmet Turan ÖZCERİT. What Operating Systems Do Computer-System Organization ...

Page 1: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

Introduction to Computer Engineering

WEEK-13Operating Systems

Assoc. Prof. Dr. Ahmet Turan ÖZCERİT

Page 2: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

2

What Operating Systems Do

Computer-System Organization

Computer-System Architecture

Operating-System Structure

Operating-System Operations

Process Management

Memory Management

Operating SystemsYou will learn:

Page 3: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

3

Computer System Organization

Page 4: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

4

Computer System Organization

Page 5: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

5

Computer System OrganizationIn isolation, the microprocessor, the memory and the input/output ports are interesting

components, but they cannot do anything useful. In combination, they can form a

complete system if they can communicate with each other. This communication is

accomplished over bundles of signal wires (known as buses) that connect the parts of the

system together.

•There are normally three types of bus in any processor system:

•An address bus: this determines the location in memory that the processor will read

data from or write data to.

•A data bus: this contains the contents that have been read from the memory

location or are to be written into the memory location.

•A control bus: this manages the information flow between components indicating

whether the operation is a read or a write and ensuring that the operation happens

at the right time.Processor Schematic Architecture

Page 6: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

6

Computer System Organization Computer-system operation

One or more CPUs, device controllers connect through common bus providing access to shared memory

Concurrent execution of CPUs and devices competing for memory cycles

Page 7: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

7

Computer system can be divided into 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

What is an Operating System?

Page 8: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

8

A program that acts as an intermediary between a user of a computer and the

computer hardware

Operating system goals:

• Execute user programs and make solving user problems easier

• Make the computer system convenient to use

• Use the computer hardware in an efficient manner 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

What is an Operating System?

Page 9: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

9

What is an Operating System?

Page 10: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

10

CPU and I/O

Page 11: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

11

Memory Architecture Main memory – only large storage media that the CPU can access directly Secondary storage – extension of main memory that provides large

nonvolatile storage capacity Magnetic disks – rigid metal or glass platters covered with magnetic

recording material Disk surface is logically divided into tracks, which are subdivided into

sectors The disk controller determines the logical interaction between the

device and the computer

Page 12: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

12

Memory Architecture

Page 13: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

13

Memory Performance

Page 14: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

14

Memory Architecture

Important principle, performed at many levels in a computer (in hardware, operating system, software)

Information in use copied from slower to faster storage temporarily 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

Cache smaller than storage being cached Cache management important design problem Cache size and replacement policy

Page 15: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

15

Operating System Concepts

Page 16: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

16

Task-Process-ThreadThe terms task and process are often used interchangeably.

A process is a program in execution. The execution of a process must progress in a sequential fashion.

A single-tasking system can only run one program at a time, while a multi-tasking operating system allows more than one program to be running in concurrency. This is achieved by time-sharing, dividing the available processor time between multiple processes which are each interrupted repeatedly in time-slices by a task scheduling subsystem of the operating system.

A thread is the smallest unit of processing that can be performed in an OS. In most modern operating systems, a thread exists within a process - that is, a single process may contain multiple threads.

Page 17: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

17

Processes A process is an executing program,

including the current values of the program counter, registers, and variables.

The subtle difference between a process and a program is that the program is a group of instructions whereas the process is the activity.

In multiprogramming systems, processes are performed in a pseudo parallelism as if each process has its own processor.

In fact, there is only one processor but it switches back and forth from one process to another.

Page 18: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

18

Processes According to these definitions, we

classify programs as Processor-bound program: A program

having long processor bursts (execution instants).

I/O-bound program: A program having short processor bursts.

Page 19: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

19

Processes Assume we have two processes A and B. Both execute for 1 second and do some I/O

work for 1 second. This pattern is repeated 3 times for process A

and 2 times for process B.

Page 20: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

20

Processes If we have no multiprogramming, the

processes are executed sequentially as below.

So, the processor executes these two processes in a total time of 10 seconds. However, it is idle at I/O instants of processes. So, it is idle for 5 seconds and utilized for 5 seconds. 

Then the processor utilization is 50%

Page 21: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

21

Process States

Start : The process has just arrived.Ready : The process is waiting to grab the

processor.Running : The process has been allocated by the

processor.Waiting : The process is doing I/O work or blocked.Halted : The process has finished and is about to

leave the system

Page 22: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

22

Process States In the OS, each process is represented by its PCB

(Process Control Block). The PCB, generally contains the following information:

Process State

Process ID,

Program Counter (PC) value,

Register values

Memory Management Information (page tables, base/bound registers,…)

Processor Scheduling Information( priority, last processor burst time etc.)

I/O Status Info (outstanding I/O requests, I/O devices held, etc.)

List of Open Files

Accounting Information

Page 23: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

23

Process States

• Scheduler: Adds new processes to the process table and removes completed processes from the process table

• Dispatcher: Controls the allocation of time slices to the processes in the process table– The end of a time slice is signaled by an

interrupt.

Page 24: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

24

Process States

Page 25: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

25

Memory ManagementLogical versus Physical Address SpaceAn address generated by the CPU is a logical address whereas address actually available on memory unit is a physical address. Logical address is also known a Virtual address.Virtual and physical addresses are the same in compile-time and load-time address-binding schemes. Virtual and physical addresses differ in execution-time address-binding scheme.The set of all logical addresses generated by a program is referred to as a logical address space. The set of all physical addresses corresponding to these logical addresses is referred to as a physical address space.The run-time mapping from virtual to physical address is done by the memory management unit (MMU) which is a hardware device. MMU uses following mechanism to convert virtual address to physical address.•The value in the base register is added to every address generated by a user process which is treated as offset at the time it is sent to memory. For example, if the base register value is 10000, then an attempt by the user to use address location 100 will be dynamically reallocated to location 10100.•The user program deals with virtual addresses; it never sees the real physical addresses.

Page 26: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

26

Memory Management

Page 27: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

27

Memory Management

Page 28: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

28

Memory Management

Page 29: Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  What Operating Systems Do  Computer-System Organization  Computer-System Architecture  Operating-System Structure.

QUESTIONS

29

?