Operating Systems Unit 7: – Virtual Memory organization Operating Systems.
Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf ·...
Transcript of Operating Systems - SourceForgealphapeeler.sourceforge.net/uit/2016_fall/CS311/week02a.pdf ·...
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
Operating System
Overview
Operating
Systems:
Internals
and Design
Principles
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
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
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
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.
A computer is a set of (shared)
resources for the movement, storage,
and processing of data
The OS is responsible for managing
these resources
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
Operating
System
as
Resource
Manager
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
Evolution of
Operating Systems
Stages include:
Serial Processing
Simple Batch Systems
Multiprogrammed Batch Systems
Time Sharing Systems
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
Serial Processing
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
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
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
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
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.
//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)
(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).
(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.
• 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
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
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