Part I Introduction Hardware and OS Review The scientist described - - PowerPoint PPT Presentation

part i introduction
SMART_READER_LITE
LIVE PREVIEW

Part I Introduction Hardware and OS Review The scientist described - - PowerPoint PPT Presentation

Part I Introduction Hardware and OS Review The scientist described what is: the engineer creates what never was. Theodor von Karman 1 Spring 2015 The father of supersonic flight Mu Multipro proce cesso ssor r Sys System ems


slide-1
SLIDE 1

1

Part I Introduction

Hardware and OS Review

Spring 2015

The scientist described what is: the engineer creates what never was. Theodor von Karman The father of supersonic flight

slide-2
SLIDE 2

2

Mu Multipro proce cesso ssor r Sys System ems

  • Multiprocessor systems, aka parallel systems or

tightly coupled systems, have more than one CPUs.

  • Adv

dvan anta tage ges:

Increased throughput: gets more jobs done Economy of scale: Because of resource sharing, multiprocessor systems are cheaper than multiple single processor systems. Increased reliability: the failure of one processor will not halt the whole system.

slide-3
SLIDE 3

3

Sym Symme metri ric c Mu Multipr proc

  • ces

essi sing ng (SM SMP) P)

  • Each processor performs all tasks under the

control of the same OS.

  • All processors are peers; no special (e.g.,

master-slave) relationship exists.

registers CPU 0 cache registers CPU 1 cache memory registers CPU 2 cache

slide-4
SLIDE 4

4

Mu Multico core re CP CPUs Us

  • This is multiprocessor on a single chip.
  • They are more efficient since communications

among cores are faster than among CPUs.

  • They also consume less power.

registers CPU core 0 cache registers CPU core 1 cache memory

slide-5
SLIDE 5

5

Dual Dual-Mo Mode de Op Oper erat ation

  • n
  • Modern CPUs have two execution modes: the

user mode and the supervisor (or system, kernel, privileged) mode, controlled by a mode bit.

  • The

he OS OS r run uns s in th n the e su supe perv rviso sor r mod

  • de

e an and d al all us user er pr prog

  • gra

rams s ru run n in n th the e us user er mod

  • de.
  • Some instructions that may do harm to the OS

(e.g., I/O and CPU mode change) are privileged

  • instructions. Privileged instructions, for most

cases, can only be used in the supervisor model.

  • When execution switches to the OS (resp., a

user program), execution mode is changed to the supervisor (resp., user) mode.

slide-6
SLIDE 6

6

Special cial Ma Machine ine Inst structions ructions

Ato tomic: These instructions execute as one uninterruptible unit. More precisely, when such an instruction is run, all other instructions being executed in various stages by the CPUs will be stopped (and perhaps re-issued later) until this instruction finishes. If two such instructions are issued at the same time, even though on different CPUs or cores, they will be executed sequentially. Pri rivi vileg eged ed: These instructions are, in general, privileged, meaning they can only execute in the supervisor or kernel mode.

slide-7
SLIDE 7

7

Int nter erru rupt pt an and d Tr Trap ap

  • An event that requires the attention of the OS

is an int nter erru rupt

  • pt. These events include the

completion of an I/O, a keypress, a request for service, a division by zero and so on.

  • Interrupts may be generated by hardware or

software.

  • An interrupt generated by software (i.e.,

division by 0) is usually referred to as a trap.

  • Modern operating systems are interrupt driven,

meaning the OS is in action only if an interrupt

  • ccurs.
slide-8
SLIDE 8

8

Wh What at Is In s Inter errup upt-Driv Driven en?

  • The OS is

activated by an interrupt.

  • The executing

program is suspended.

  • Control is

transferred to the OS.

  • A program will be

resumed when the service completes. interrupt ADD #4, 3 interrupt handler service

kernel

mode switch

kernel mode user mode

slide-9
SLIDE 9

9

Sy Syst stem em Ca Calls

  • System calls provide an interface to the services

made available by an operating system.

  • A system call generates an interrupt (actually a

trap), and the caller is suspended.

  • Type of system calls:

Process control (e.g., create and destroy processes) File management (e.g., open and close files) Device management (e.g., read and write operations) Information maintenance (e.g., get time or date) Communication (e.g., send and receive messages)

slide-10
SLIDE 10

10

Sy Syst stem em Ca Call Me Mech chan anism sm: 1/ 1/2

load addr. X syscall 10 X register syscall 10 service routine syscall

parameters a trap

slide-11
SLIDE 11

11

Sys System em Ca Call Me Mech chan anism sm: 2/ 2/2

  • A system call generates

an interrupt, actually a trap.

  • The executing program

(i.e., caller) is suspended.

  • Control is transferred to

the OS.

  • A program will be

resumed when the system call service completes.

syscall 10 interrupt handler

syscall services

kernel

mode switch

kernel mode user mode

slide-12
SLIDE 12

12

Ti Timer er

  • Because the operating system must maintain the

control over the CPU, it has to prevent a user program from getting the CPU forever without calling for system service (i.e., I/O).

  • Use

se an an int nter erva val t timer er! An interval timer is a count-down timer.

  • Before a user program runs, the OS sets the

interval timer to certain value. Once the interval timer counts down to 0, an interrupt is generated and the OS can take appropriate action.

slide-13
SLIDE 13

13

The End