Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf ·...

26
Engr. Abdul-Rahman Mahmood MS, PMP, MCP, QMR(ISO9001:2000) [email protected] [email protected] alphapeeler.sf.net/pubkeys/pkey.htm http://alphapeeler.sourceforge.net pk.linkedin.com/in/armahmood http://alphapeeler.tumblr.com www.twitter.com/alphapeeler [email protected] www.facebook.com/alphapeeler [email protected] abdulmahmood-sss alphasecure mahmood_cubix 48660186 [email protected] [email protected] http://alphapeeler.sf.net/me http://alphapeeler.sf.net/acms/ VC++, VB, ASP Operating Systems

Transcript of Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf ·...

Page 1: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Engr. Abdul-Rahman MahmoodMS, PMP, MCP, QMR(ISO9001:2000)

[email protected] [email protected]

alphapeeler.sf.net/pubkeys/pkey.htm http://alphapeeler.sourceforge.net

pk.linkedin.com/in/armahmood http://alphapeeler.tumblr.com

www.twitter.com/alphapeeler [email protected]

www.facebook.com/alphapeeler [email protected]

abdulmahmood-sss alphasecure mahmood_cubix 48660186

[email protected] [email protected]

http://alphapeeler.sf.net/me http://alphapeeler.sf.net/acms/

VC++, VB, ASP

Operating Systems

Page 2: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Operating System

Overview

Operating

Systems:

Internals

and Design

Principles

Page 3: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Operating Systems:

Internals and Design Principles

Operating systems are those programs that interface the machine

with the applications programs. The main function of these systems

is to dynamically allocate the shared system resources to the

executing programs. As such, research in this area is clearly

concerned with the management and scheduling of memory,

processes, and other devices. But the interface with adjacent levels

continues to shift with time. Functions that were originally part of the

operating system have migrated to the hardware. On the other side,

programmed functions extraneous to the problems being solved by the

application programs are included in the operating system.

—WHAT CAN BE AUTOMATED?: THE COMPUTER SCIENCE AND

ENGINEERING RESEARCH STUDY,

MIT Press, 1980

Page 4: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Operating System

A program that controls the execution of

application programs

An interface between applications and hardware

Main objectives of an OS:

• Convenience

• Efficiency

• Ability to evolve

Page 5: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs
Page 6: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Program development: IDE

Program execution: process creation

Access I/O devices

Controlled access to files

System access

Error detection and response

Accounting: response time, billing

Page 7: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Key Interfaces

Instruction set architecture (ISA): boundary between

hardware and software. Defines the repertoire of

machine language instructions User ISA: subset of the instruction repertoire that application

programs / utilities can access directly.

System ISA: OS has access to additional machine language

instructions that deal with managing system resources

Application binary interface (ABI):Provides binary

portability to programs & system call interface in OS.

Application programming interface (API): gives a

program access to the hardware resources and services

available in a system through the user ISA supplemented

with high-level language (HLL) library calls.

Page 8: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

A computer is a set of (shared)

resources for the movement, storage,

and processing of data

The OS is responsible for managing

these resources

Page 9: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Functions in the same way as ordinary

computer software

Program, or suite of programs, executed

by the processor

Frequently relinquishes control and must

depend on the processor to allow it to

regain control

Page 10: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Operating

System

as

Resource

Manager

Page 11: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Evolution of Operating Systems

A major OS will evolve over time for a

number of reasons:

Hardware upgrades

New types of hardware

New services

Fixes

early versions

of UNIX did not employ a paging mechanism

graphics terminals and page-mode

terminals

performance management tool

patches

Page 12: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Evolution of

Operating Systems

Stages include:

Serial Processing

Simple Batch Systems

Multiprogrammed Batch Systems

Time Sharing Systems

Page 13: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Serial Processing

Earliest Computers:

No OS (1948-1955)

programmers interacted

directly with the computer

hardware

Computers had a console

with display lights, toggle

switches, some form of input

device, printer

Users have access to the

computer in “series”

Problems:

Scheduling:

most installations used a

hardcopy sign-up sheet to

reserve computer time

time allocations could

run short or long,

resulting in wasted

computer time

Setup time

a considerable amount of

time was spent just on setting

up the program to run

Page 14: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Serial Processing

Page 15: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Simple Batch Systems

Early computers were very expensive

important to maximize processor utilization

Monitor (software )

user no longer has direct access to processor

job is submitted to computer operator who batches them

together and places them on an input device

program branches back to the monitor when finished

Page 16: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Monitor controls the sequence

of events

Resident Monitor is software

always in memory

Monitor reads in job and gives

control

Job returns control to monitor

Page 17: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Processor executes instruction from the memory

containing the monitor

Executes the instructions in the user program until it

encounters an ending or error condition

“control is passed to a job” means processor is fetching and

executing instructions in a user program

“control is returned to the monitor” means that the processor

is fetching and executing instructions from the monitor

program

Page 18: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Job Control Language (JCL)

Special type of programming language used to provide

instructions to the monitor

what compiler to use

what data to use

$JOB

$FTN

[FORTRAN program]

$LOAD

$RUN

[data]

$END

$FTN - execute FORTRAN compiler;

$ASM - execute Assembler;

$RUN - execute user program;

$JOB - first card;

$END - last card;https://en.wikipedia.org/wiki/Job_Control_Language

Page 19: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

A job is a unit of work which can be made up of

many job steps. Each job step is specified in a

Job Control Language (JCL) through a set of

Job Control Statements.

The Operating System uses Job Entry System

(JES) to receive jobs into the Operating System,

to schedule them for processing and to control

the output.

Page 20: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs
Page 21: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

//SAMPJCL JOB 1,CLASS=6,MSGCLASS=0,NOTIFY=&SYSUID (1)

//* (2)

//STEP010 EXEC PGM=SORT (3)

//SORTIN DD DSN=JCL.SAMPLE.INPUT,DISP=SHR (4)

//SORTOUT DD DSN=JCL.SAMPLE.OUTPUT, (5)

// DISP=(NEW,CATLG,CATLG),DATACLAS=DSIZE50

//SYSOUT DD SYSOUT=* (6)

//SYSUDUMP DD SYSOUT=C (6)

//SYSPRINT DD SYSOUT=* (6)

//SYSIN DD * (6)

SORT FIELDS=COPY

INCLUDE COND=(28,3,CH,EQ,C'XXX')

/* (7)

Page 22: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

(1) JOB statement - Specifies the information required

for SPOOLing of the job such as job id, priority of

execution, user-id to be notified upon completion of the

job.

(2) //* statement - This is a comment statement.

(3) EXEC statement - Specifies the PROC/Program to

be executed. In the above example, a SORT program is

being executed (i.e., sorting the input data in a particular

order)

(4) Input DD statement - Specifies the type of input to

be passed to the program mentioned in (3). In the above

example, a Physical Sequential (PS) file is passed as

input in shared mode (DISP = SHR).

Page 23: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

(5) Output DD statement - Specifies the type of output to be produced by

the program upon execution. In the above example, a PS file is created. If a

statement extends beyond the 70th position in a line, then it is continued in

the next line, which should start with "//" followed by one or more spaces.

(6) There can be other types of DD statements to specify additional

information to the program (In the above example: The SORT condition is

specified in the SYSIN DD statement) and to specify the destination for

error/execution log (Example: SYSUDUMP/SYSPRINT). DD statements

can be contained in a dataset (mainframe file) or as in stream data

(information hard-coded within the JCL) as given in above example.

(7) /* marks the end of in stream data.

All the JCL statements except in stream data starts with //. There should be

at least one space before and after JOB, EXEC and DD keywords and there

should not be any spaces in rest of the statement.

Page 24: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

• while the user program is executing, it must not alter the memory area containing the monitor

Memory protection for monitor

• prevents a job from monopolizing the system

Timer

• can only be executed by the monitor

Privileged instructions

• gives OS more flexibility in controlling user programs

Interrupts

Page 25: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Modes of Operation

User Mode

• user program executes in user mode

• certain areas of memory are protected from user access

• certain instructions may not be executed

Kernel Mode

• monitor executes in kernel mode

• privileged instructions may be executed

• protected areas of memory may be accessed

Page 26: Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf · Operating Systems: Internals and Design Principles Operating systems are those programs

Simple Batch System Overhead

Processor time alternates between execution of user

programs and execution of the monitor

Sacrifices:

some main memory is now given over to the monitor

some processor time is consumed by the monitor

Despite overhead, the simple batch system improves

utilization of the computer