BYU CS 345 Chapter 2: OS Overview

BYU CS 345 Chapter 2: OS Overview BYU CS 345 Chapter 2: OS Overview - Start

2018-09-19 2K 2 0 0

Download Presentation

BYU CS 345 Chapter 2: OS Overview




Download Presentation - The PPT/PDF document "BYU CS 345 Chapter 2: OS Overview" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.



Presentations text content in BYU CS 345 Chapter 2: OS Overview

Slide1

BYU CS 345

Chapter 2: OS Overview

1

Event-driven programming

Event-driven programming is a programming paradigm in which the flow of the program is determined by

sensor outputs,

user actions (mouse clicks, key presses), or

messages from other programs or threads.

interrupts

Application has a main loop

Event selection (scheduler).

Event handling (dispatcher).

Events

are external

to a

task

Signals are

asynchronous

events

Occur anytime, handled by call-back

functions

Semaphores are

synchronous

events.

Occur anytime, handled by semaphores

Slide2

BYU CS 345

Chapter 2: OS Overview

2

Project 1 File Summary…

Files needing attention:

os345tasks.c

createTask

,

sysKillTask

os345interrupts.c

keyboard_isr

os345signals.c

signals,

sigAction

,

sigSignal

,

defaultSigxxHandler

,

createTaskSigHandlers

os345p1.c

– P1_shellTask, P1_help …

os345.h

– your equates

Signal Event Handlers

int

signals(void);

int

sigAction

(

void (*sigHandler)(void), int sig

);

int

sigSignal

(

int

taskId

,

int

sig);

void

defaultSigxxxHandler

(void);

v

oid

createTaskSigHandlers

(

int

tid

)

Slide3

BYU CS 345

Chapter 2: OS Overview

3

1.4 Signals

A

signal is an asynchronous notification of an event that is sent to a process before it is rescheduled for execution.

Blocked processes are not un-blocked by a signal, but rather the signal remains pending until such time as the process is un-blocked and scheduled for execution.

Before

a task is scheduled

by

the function

dispatcher

(os345.c), the function

signals

(os345signals.c)

is called:

Modify

the function

signals

(os345signals.c) to call all pending task signal handlers

.

Modify

the function

createTaskSigHandlers

(

os345signals.c)

such that a

child task

inherits

all its parent signal handlers

.

Modify

the function

sigAction

(os345signals.c) to register new task signal handlers

.

Add

default signal handlers as

needed.

Implement

all signals and signal handlers

such that:

Cntrl

-X terminates (kills) all tasks except task 0 (shell).

Cntrl

-W pauses the execution of all tasks.

Cntrl

-R continues the execution of all tasks after a pause.

Slide4

BYU CS 345

Chapter 2: OS Overview

4

1.4 Signals Example

Signals

Task registers

call-back

signal handler

functions

with the OS:

sigAction

(

mySIGINTHandler

, SIGINT

);

sigAction

(

mySIGTERMHandler

, SIGTERM);

keyboard_isr

() detects a

cntrl

-X and sends a SIGINT signal to the shell:

sigSignal(0, SIGINT);

createTask

calls createTaskSigHandlers() to setupdefault / parent signal handlers: void createTaskSigHandlers(int tid){ tcb[tid].sigIntHandler = defaultSigIntHandler; tcb[tid].sigTermHandler = defaultSigTermHandler; return;}

void mySIGINTHandler(void) void mySIGTERMHandler(void){ sigSignal(-1, SIGTERM); { killTask(curTask); return; return;} }

createTask

()

Ready

SWAP

d

ispatch()

Running

sysKillTask

()

Exit

Dispatcher calls signal

handlers before

rescheduling task

:

New

Slide5

BYU CS 345

Chapter 2: OS Overview

5

Signal Handling

Signals

Slide6

BYU CS 345Chapter 2: OS Overview6Keyboard InputActionCntrl-X

sigSignal SIGINT to shellClear input buffersemSignal inBufferReadyCntrl-RsigSignal SIGCONT to all tasksClear SIGSTOP from all tasksClear SIGTSTP from all tasksCntrl-WsigSignal SIGTSTP to all tasks

Keyboard Interrupts

Slide7

BYU CS 345

Chapter 2: OS Overview

7

Project 1 Signals Quiz

What is a signal?

Who can signal?

When is a signal acknowledged?

How are signals delivered to a process?

What operations are illegal within a signal handler?

How are parameters passed to a signal?

What signals might a process not handle?

How many signals might a system support?

Slide8

BYU CS 345Chapter 2: OS Overview8$ kill –l1) SIGHUP 2)

SIGINT 3) SIGQUIT 4) SIGILL5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE9) SIGKILL

10) SIGUSR1 11) SIGSEGV 12) SIGUSR213) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGSTKFLT17)

SIGCHLD 18)

SIGCONT

19

)

SIGSTOP 20

)

SIGTSTP

21

)

SIGTTIN 22

)

SIGTTOU 23

)

SIGURG 24

)

SIGXCPU

25) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28)

SIGWINCH

29) SIGIO 30) SIGPWR 31) SIGSYS 34) SIGRTMIN35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3 38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42

) SIGRTMIN+843)

SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+1247) SIGRTMIN+13 48)

SIGRTMIN+14 49)

SIGRTMIN+15 50) SIGRTMAX-1451) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7 58) SIGRTMAX-659) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-263) SIGRTMAX-1 64) SIGRTMAX

Slide9

BYU CS 345

Chapter 2: OS Overview

9

CS 345

Stalling’s Chapter

#

Project

1: Computer System Overview

2: Operating System Overview

4

P1:

Shell

3: Process Description and Control

4: Threads

4

P2: Tasking

5: Concurrency: ME and Synchronization

6: Concurrency: Deadlock and Starvation

6

P3: Jurassic Park

7: Memory

Management8: Virtual memory6P4: Virtual Memory9: Uniprocessor Scheduling10: Multiprocessor and Real-Time Scheduling6P5: Scheduling11: I/O Management and Disk Scheduling12: File Management8P6: FATStudent Presentations6

Slide10

CS 345Computer System OverviewChapter 2

Slide11

Chapter 2 Learning ObjectivesSummarize, at a top level, the key functions of an operating system.Discuss the evolution of operating systems from early simple batch systems to modern complex systems.Give a brief explanation of each of the major achievements in OS research.Discuss the key design areas that have been instrumental in the development of modern operating systems.Define and discuss virtual machines and virtualization.Understand the OS design issues raised by the introduction of multiprocessor and multicore organization.Understand the basic structure of Windows 7.Describe the essential elements of a traditional UNIX system.Explain the new features found in modern UNIX systems.Discuss Linux and its relationship to UNIX.BYU CS 345

Chapter 2: OS Overview11

Slide12

BYU CS 345

Chapter 2: OS Overview

12

Evolution of Operating Systems

Early Systems (1950)

Simple Batch Systems (1960)

Multiprogrammed

Batch Systems (1970)

Time-Sharing and Real-Time Systems (1970)

Personal/Desktop Computers (1980)

Multiprocessor Systems (1980)

Networked/Distributed Systems (1980)

Web-based Systems (1990)

Virtualization …

Evolution

https://www.cs.rutgers.edu/~pxk/416/notes/01-intro.html

1

st

generation 1945 – 1955

- vacuum tubes, plug boards

2

nd generation 1955 – 1965 - transistors, batch systems3rd generation 1965 – 1980

- ICs and multiprogramming4th generation 1980 – present - personal computers5th generation - ??? - ubiquitousness, mobile,

Slide13

BYU CS 345

Chapter 2: OS Overview

13

Chapter 2

Reading Quiz

What are the objectives of an OS?

What services does an OS provide?

What computer resources need management?

What hardware advancements facilitated OS development?

What is JCL?

What does

SPOOLing

stand for?

What is a Virtual Machine? Why Virtualize?

What differentiates Windows 7, UNIX, and Linux?

Slide14

BYU CS 345

Chapter 2: OS Overview

14

1. What are the Objectives of an OS?

Convenience

Make the computer more convenient to use

Efficiency

Efficient use of computer system resources

Accessibility

Uniformity

Ability to evolve

Permit effective development, testing, and introduction of new system functions without interfering with service

Objectives

Slide15

BYU CS 345

Chapter 2: OS Overview

15

2. What Services does an OS provide?

Program development

Editors, debuggers, frameworks

Program execution

Initialization, scheduling

Access to I/O devices

Uniform interface, hides details

Controlled access to files

Authorization, sharing, caching

System access

Protection, authorization, resolve conflicts

Error detection and response

Hardware errors: memory error or device failure

Software errors: arithmetic errors, access forbidden memory

locations

errors

AccountingCollect statistics (billing), monitor performance (future enhancements)

Services

Operating systems are among the most complex pieces of software ever developed...

Slide16

BYU CS 345

Chapter 2: OS Overview

16

3. What Resources need management?

Memory

Cache

Virtual

Secondary

Peripherals

C

omputer programs

User programs

Shared libraries

Concurrency / Synchronization

CPU cores

Resource

Management

Slide17

BYU CS 345

Chapter 2: OS Overview

17

4. What H/W Advancements?

Memory protection (1960’s)

do not allow the memory area containing the monitor to be altered by a user program.

Privileged instructions

can be executed only by the resident monitor.

A trap occurs if a program tries these instructions.

Interrupts (1956)

provide flexibility for relinquishing control to and regaining control from user programs.

Timer interrupts prevent a job from monopolizing the system.

Hardware Advancements

Slide18

BYU CS 345

Chapter 2: OS Overview

18

Characteristics of Early Systems

Early software: Assemblers, Libraries of common subroutines (I/O, Floating-point), Device Drivers, Compilers, Linkers.

Need significant amount of setup time.

Extremely slow I/O devices.

Very low CPU utilization.

But computer was very secure.

Early Systems

Slide19

BYU CS 345

Chapter 2: OS Overview

19

Early Systems

Structure

Single user system.

Programmer/User as operator (Open Shop).

Large machines run from console.

Paper Tape or Punched cards.

Early Systems

Slide20

BYU CS 345

Chapter 2: OS Overview

20

Early Computer System

Early Systems

Slide21

BYU CS 345

Chapter 2: OS Overview

21

Offline Operation

Problem:

Card Reader slow, Printer slow (compared to Tape).

I/O and CPU could not overlap.

Solution: Offline Operation (Satellite Computers)

Speed up computation

by loading jobs into memory from tapes while card

reading and line printing is

done off-line using smaller machines

.

Hardware Advancements

Slide22

BYU CS 345

Chapter 2: OS Overview

22

Simple Batch Systems

Use of high-level languages, magnetic tapes.

Jobs are batched together by type of languages.

An operator

was hired to perform the repetitive tasks of loading jobs, starting the computer, and collecting the output (Operator-driven Shop).

It was not feasible for users

to inspect memory or patch programs directly.

Batch Systems

Slide23

BYU CS 345

Chapter 2: OS Overview

23

5. What is JCL

?

Job Control language is the language that provides instructions to the monitor:

what compiler to use

what data to use

Example of job format: ------->>

$FTN

loads the compiler and transfers control to it.

$LOAD

loads the object code (in place of compiler).

$RUN

transfers control to user program.

$JOB

$FTN

...

FORTRAN

program

...

$LOAD$RUN...Data...$END

Batch Systems

Slide24

BYU CS 345

Chapter 2: OS Overview

24

Operator-driven Shop

Batch Systems

Slide25

BYU CS 345

Chapter 2: OS Overview

25

Simple Batch Systems

The user submits a job (written on cards or tape) to a computer operator.

The computer operator place a batch of several jobs on an input device.

A special program called the monitor, manages the execution of each program in the batch.

“Resident monitor” is always in main memory and available for execution.

Monitor utilities are loaded when needed.

Reduce setup time by batching similar jobs.

Alternate execution between user program and the monitor program.

Use Automatic Job Sequencing – automatically transfer control from one job when it finishes to another one.

Rely on available hardware to effectively alternate execution from various parts of memory.

Batch Systems

Slide26

BYU CS 345

Chapter 2: OS Overview

26

Special cards that tell the monitor which programs to run:

$JOB

$FTN

$RUN

$DATA

$END

Special characters distinguish control cards from data or program cards:

$ in column 1

// in column 1 and 2

709 in column1

Control Cards

Batch Systems

Slide27

BYU CS 345

Chapter 2: OS Overview

27

Card Deck of a Job

Batch Systems

Slide28

BYU CS 345

Chapter 2: OS Overview

28

Uniprogramming

I/O operations are exceedingly slow (compared to instruction execution).

A program containing even a very small number of I/O operations, will spend most of its time waiting for them.

Hence: poor CPU usage when only one program is present in memory.

Uniprogramming

Slide29

BYU CS 345

Chapter 2: OS Overview

29

Batch Multiprogramming

Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them.

Multiprogramming

Slide30

BYU CS 345

Chapter 2: OS Overview

30

Allows the processor to execute another program while one program must wait for an I/O device.

Concurrent Multiprogramming

Multiprogramming

Slide31

BYU CS 345

Chapter 2: OS Overview

31

Why Multiprogramming?

Single user cannot keep CPU and I/O devices busy at all times.

Multiprogramming organizes jobs (code and data) so CPU always has one to execute.

A subset of total jobs in system is kept in memory.

One job selected and run via job scheduling.

When it has to wait, OS switches to another job.

Multiprogramming

Slide32

BYU CS 345

Chapter 2: OS Overview

32

Multiprogramming Requirements

Hardware support:

I/O interrupts and DMA controllers

in order to execute instructions while I/O device is busy.

Timer interrupts for CPU to gain control.

Memory management

several ready-to-run jobs must be kept in memory.

Memory protection (data and programs).

Software support from the OS:

For scheduling (which program is to be run next).

To manage resource contention.

Multiprogramming

Slide33

Cluster computing

Loosely coupled - network

Client / server environmentMiddlewareDME, RPCMulti (processor/core)Traditionally, the computer has been viewed as a sequential machine.Multiple control signalsPipeliningBYU CS 345Chapter 2: OS Overview33

Parallelism

Symmetric Multiprocessors (SMP)

2 or more identical processors that share resources

Integrated OS to control jobs, tasks, files, data elements…

High degree of interaction/cooperation between processes

Multicore Computers

Single piece of silicon (die)

Independent processors + levels of cache

Intel Core i7

Prefetching

Multiprocessing

Slide34

BYU CS 345

Chapter 2: OS Overview

34

6. What does Spool stand for?

Problem:

Card reader, Line printer and Tape drives slow

I/O and CPU could not overlap.

Solution: Spooling -

Overlap I/O of one job with the computation of another job (using double buffering, DMA,

etc

).

Technique is called

SPOOLing

: Simultaneous Peripheral Operation On Line.

Spooling

Slide35

BYU CS 345

Chapter 2: OS Overview

35

7

. What is a Virtual Machine?

Virtualization technology enables a single PC or server to simultaneously run multiple operating systems on a single platform.

The host OS can support many virtual machines, each with characteristics of a particular OS.

Virtual Machine

Slide36

BYU CS 345

Chapter 2: OS Overview

36

8. Windows 7, Unix, Linux?

Windows 7

Slide37

BYU CS 345

Chapter 2: OS Overview

37

Modern OS Architecture

System Architecture

Slide38

BYU CS 345

Chapter 2: OS Overview

38

Desktop Market Share

Slide39

BYU CS 345

Chapter 2: OS Overview

39

Desktop Market Share

Slide40

BYU CS 345

Chapter 2: OS Overview

40

Slide41

Slide42

Slide43


About DocSlides
DocSlides allows users to easily upload and share presentations, PDF documents, and images.Share your documents with the world , watch,share and upload any time you want. How can you benefit from using DocSlides? DocSlides consists documents from individuals and organizations on topics ranging from technology and business to travel, health, and education. Find and search for what interests you, and learn from people and more. You can also download DocSlides to read or reference later.