Date post: | 10-Apr-2018 |
Category: |
Documents |
Upload: | pratik-jain |
View: | 222 times |
Download: | 0 times |
of 38
8/8/2019 Languages and Os
1/38
Compiled by :Compiled by :
S. Agarwal,S. Agarwal,Lecturer & Systems InchargeLecturer & Systems Incharge
St. Xaviers Computer Centre,St. Xaviers Computer Centre,
St. Xaviers CollegeSt. Xaviers College
Kolkata.Kolkata.
March-2003
8/8/2019 Languages and Os
2/38
WHAT IS PROGRAMWHAT IS PROGRAM
A program is a sequence of instructions that a
computer can interpret and execute. It is developed
using high level computer languages.
WHAT IS SOFTWAREWHAT IS SOFTWARE
Software is computer program or a set of programs, which provides the instructions which
enable the computer hardware to work. Two main
types of software are system software (operatingsystems), which control the workings of the
computer, and applications, such as word
processing programs, spreadsheets, and databases.
8/8/2019 Languages and Os
3/38
Types of Languages Used toTypes of Languages Used to
Write a SoftwareWrite a Software
Machine LanguageMachine Language
Assembly LanguageAssembly Language
High Level LanguageHigh Level Language
8/8/2019 Languages and Os
4/38
Machine LanguageMachine Language
A set of machine instructions written using binary code that a processorA set of machine instructions written using binary code that a processorcan understand.can understand.
A processor interprets and translates machine instructions into HWA processor interprets and translates machine instructions into HWsignals.signals.
Example:Example:the instruction to add 2 numbers stored in registers A and B might lookthe instruction to add 2 numbers stored in registers A and B might looklike this:like this:
00000011 1100001100000011 11000011Problems:Problems: Binary representation of instructions and data are not easily generated,Binary representation of instructions and data are not easily generated,
manipulated, or understood by humans.manipulated, or understood by humans. The languages are machine dependent.The languages are machine dependent. Writing program in machine language requires the knowledge of theWriting program in machine language requires the knowledge of the
internals of the computer.internals of the computer.
8/8/2019 Languages and Os
5/38
Assembly LanguageAssembly Language
AA symbolic formsymb
olic form of machine languageof machine language Allows alphabeticAllows alphabetic mnemonicsmnemonics for operation codes andfor operation codes and
storage locationsstorage locations There exists one-to-one correspondence betweenThere exists one-to-one correspondence betweenassembly instructions and machine instructions.assembly instructions and machine instructions.
Example:
M. L. Instruction:M. L. Instruction: 00000011 1100001100000011 11000011
Equivalent A.L. Instruction:Equivalent A.L. Instruction: ADD A, BADD A, B
8/8/2019 Languages and Os
6/38
Advantages .Advantages .
Ease: Because of the use of mnemonics it isEase: Because of the use of mnemonics it ismore understandable and easy to remembermore understandable and easy to rememberthan a machine language code..than a machine language code..
Speed: programs in AL run faster than thoseSpeed: programs in AL run faster than thosewritten in high level languages.written in high level languages.
Compactness: routines include only code thatCompactness: routines include only code that
programmers want to include.programmers want to include. Versatility: anything that can be done with aVersatility: anything that can be done with a
computer can be done with ALcomputer can be done with AL
8/8/2019 Languages and Os
7/38
Problems .Problems .
Big programs in assembly language : harderBig programs in assembly language : harder
to write and error prone.to write and error prone.
The languages are machine dependent.The languages are machine dependent. The programmer must still be aware of theThe programmer must still be aware of the
internal architecture of the target machine.internal architecture of the target machine.
8/8/2019 Languages and Os
8/38
High Level LanguageHigh Level Language
Use English like codes that are easier to remember.Use English like codes that are easier to remember. Generally machine (architecture)Generally machine (architecture) independent.independent. Provides language constructs for specifying andProvides language constructs for specifying and
manipulating complex data structures.manipulating complex data structures. Supports a variety of programming styles (i.e. linear,Supports a variety of programming styles (i.e. linear,
object oriented)object oriented) Hides the low level architectural details from theHides the low level architectural details from the
programmer i. e. dose not normally require theprogrammer i. e. dose not normally require the
knowledge of the internal architecture of the computers.knowledge of the internal architecture of the computers.
Example :Example : C, C++, Pascal, COBOL, JavaC, C++, Pascal, COBOL, Java
8/8/2019 Languages and Os
9/38
Binary codesBinary codes
SomeSomebinary codes usedbinary codes used
to represent informationto represent information
in a digital computer:in a digital computer:
1) BCD Code1) BCD Code2) ASCII Code2) ASCII Code
3) Gray Code3) Gray Code
4) EBCDIC Code4) EBCDIC Code
5) Excess-3 Code5) Excess-3 Code
8/8/2019 Languages and Os
10/38
BCD CODEBCD CODE
BCD stands forBCD stands for BBinary-inary-CCodedoded DDecimal.ecimal.
A BCD number is a four-bit binary groupA BCD number is a four-bit binary group
that represents one of the ten decimal digitsthat represents one of the ten decimal digits
0 through 9.0 through 9.Example:
Decimal number 4926 4 9 2 6
8421 BCD coded number 0100 1001 0010 0110
8/8/2019 Languages and Os
11/38
THETHE ASCIIASCII CODECODE
ASCIIASCII is acronym foris acronym for AAmericanmerican SStandardtandard CCodeodeforfor IInformationnformation IInterchangenterchange
Represents numbers, letters, punctuation marksRepresents numbers, letters, punctuation marks
and control charactersand control characters Standard ASCII is a 7-bit code (127 characters)Standard ASCII is a 7-bit code (127 characters)
Extended ASCII (IBM ASCII), an 8-bit code, isExtended ASCII (IBM ASCII), an 8-bit code, is
also very popularalso very popular Extended ASCII adds graphics and math symbolsExtended ASCII adds graphics and math symbols
to code (total of 256 symbols)to code (total of 256 symbols)
8/8/2019 Languages and Os
12/38
BIT PATTERN ASCII CODE CHARACTER
01000001 65 A
01100001 97 a
00110001 49 100101011 43 +
00100000 32
00101101 45 -
00011100 28 (
00101100 44 ,
ASCII : Example ..ASCII : Example ..
8/8/2019 Languages and Os
13/38
0x000000 00100111101111011111111111100000
0x000004 10101111101111110000000000010100
0x000008 10101111101001000000000000100000
0x00000c 10101111101001010000000000100100
0x000010 10101111101000000000000000011000
0x000014 10101111101000000000000000011100
0x000018 10001111101011100000000000011100
0x00001c 00000001110011100000000000011001
0x000020 00000000000000000111100000010010
0x000024 10001111101110000000000000011000
0x000028 00000011000011111100100000100001
0x00002c 101011111010100000000000000111000x000030 00100101110010000000000000000001
0x000034 10101111101110010000000000011000
0x000038 00101001000000010000000001100101
0x00003c 00010100001000001111111111110111
0x000040 00111100000001000001000000000000
0x000044 00110100100001000000010000110000
0x000048 10001111101001010000000000011000
0x00004c 00001100000100000000000011101100
0x000050 00000000000000000001000000100001
0x000054 10001111101111110000000000010100
0x000058 00100111101111010000000000100000
0x00005c 00000011111000000000000000001000
TranslatorsTranslators
Used to translate otherUsed to translate other
forms of languages intoforms of languages into
machine language.machine language.
Three types of commonlyThree types of commonly
used translators are :used translators are :
1) Assembler1) Assembler
2) Compiler2) Compiler3) Interpreter3) Interpreter
8/8/2019 Languages and Os
14/38
AssemblerAssembler
A program thatA program that converts assembly code into machine codeconverts assembly code into machine code
After translation creates object module i.e. the machine languageAfter translation creates object module i.e. the machine language
representation of a programrepresentation of a program
8/8/2019 Languages and Os
15/38
How does an assembler work ?
8/8/2019 Languages and Os
16/38
CompilerCompiler
Translates high-level code
into machine language code.
Produces object code
(Translated Instructions ready
for computer)) by translatingthe ssource code ( high-level
language instruction ).
Object code is stored in the
machine and can be usedrepeatedly.
8/8/2019 Languages and Os
17/38
SOURCE CODESOURCE CODE
PROGRAMPROGRAM
COMPILERCOMPILER
OBJECT CODEOBJECT CODE
LINKAGELINKAGE
EDITOREDITOR
LOAD MODULELOAD MODULE
OTHER OBJECTOTHER OBJECT
CODE MODULESCODE MODULES
TRANSLATIONTRANSLATION
PROCESSPROCESS
8/8/2019 Languages and Os
18/38
Digital Computer as a Multilevel MachineDigital Computer as a Multilevel Machine
High Level Language Level
Assembly Language Level
Operating System Level
Machine Language Level
Microprogram Level
Digital Logic Level
Translation(Compiler)
Translation(Assembler)
So
ftwar
e
Ha
rdw
ar
e
Machine code
Machine code
Partial Interpretation,
Partial Pass-through
Interpretation (microprogram)
Directly executed by hardware
Applications Level
8/8/2019 Languages and Os
19/38
InterpreterInterpreter Like compiler translates a high level language into machine language.Like compiler translates a high level language into machine language.
Unlike compiler translates the program at the time of executing theUnlike compiler translates the program at the time of executing theprogram instruction by instruction.program instruction by instruction.
The translated code is not stored permanently in computers memory,The translated code is not stored permanently in computers memory,hence before each execution interpretation becomes necessary.hence before each execution interpretation becomes necessary.
As object code is not stored in the computer, execution of the programAs object code is not stored in the computer, execution of the program
becomes slower because of the need for interpretation before eachbecomes slower because of the need for interpretation before eachexecution.execution. Normally it is easier to design an interpreter than a compiler.Normally it is easier to design an interpreter than a compiler.
8/8/2019 Languages and Os
20/38
Generations of LanguagesGenerations of Languages
1st. Since 1940s. MACHINE LANGUAGE: binary code.
2nd.Since early 50s. ASSEMBLY LANGUAGE:
mnemonics for numeric code.
3rd.Since mid 50s. HIGH-LEVEL LANGUAGES:procedural in nature.
e.g.C, C++, COBOL
4th.Since late 70s. MODERN APPLICATION PACKAGES:
non-procedural in nature. e.g. Structured Query Language (SQL)
8/8/2019 Languages and Os
21/38
8/8/2019 Languages and Os
22/38
SYSTEM SOFTWARESYSTEM SOFTWARE
The system softwares are programs speciallyThe system softwares are programs specially
designed for controlling the computerdesigned for controlling the computer
hardware, ensuring the proper utilization of thehardware, ensuring the proper utilization of the
computer resources and providing a convenientcomputer resources and providing a convenient
environment to the users of the computer toenvironment to the users of the computer to
work with.work with.
Example:Example: Operating system, Compiler,Operating system, Compiler,
Interpreter, Loader, LinkerInterpreter, Loader, Linker
8/8/2019 Languages and Os
23/38
APPLICATION SOFTWAREAPPLICATION SOFTWAREThese are programs developed by the users of the computer toThese are programs developed by the users of the computer to
perform a specific task. They can be of two types:perform a specific task. They can be of two types:
a) Ready Made:a) Ready Made:
These are programs developed by software companies for generalThese are programs developed by software companies for general
purpose applications. These programs can be bought and can bepurpose applications. These programs can be bought and can be
installed for performing some predefined job.installed for performing some predefined job.
Examples :Examples :MS-WORD, FACT, TALLY, FOXPRO etc.MS-WORD, FACT, TALLY, FOXPRO etc.
b) Customized or Tailor made :b) Customized or Tailor made :
These are programs developed for SPECIFIC USER REQUIREMENTThese are programs developed for SPECIFIC USER REQUIREMENT
within an organization. These programs are developed by programmerswithin an organization. These programs are developed by programmers
as per the user requirementsas per the user requirements..
Example:Example:Library Management System, Hotel Management System,Library Management System, Hotel Management System,
Railway Reservation SystemRailway Reservation System
8/8/2019 Languages and Os
24/38
SOFTWARE LAYERSSOFTWARE LAYERS
HARDWARE
OPERATING SYSTEM:OPERATING SYSTEM:
SCHEDULED COMPUTER EVENTSSCHEDULED COMPUTER EVENTS
ALLOCATES COMPUTERALLOCATES COMPUTER
RESOURCESRESOURCES
MONITORS EVENTSMONITORS EVENTS
LANGUAGE TRANSLATORS:LANGUAGE TRANSLATORS:
INTERPRETERSINTERPRETERS
COMPILERSCOMPILERS
UTILITY PROGRAMS:UTILITY PROGRAMS:
ROUTINE OPERATIONSROUTINE OPERATIONS
MANAGE DATAMANAGE DATA
PROGRAMMING LANGUAGES:PROGRAMMING LANGUAGES:
ASSEMBLY LANGUAGE; FORTRAN;ASSEMBLY LANGUAGE; FORTRAN;
COBOL; PL / 1; QBASIC; PASCAL; C; C++;COBOL; PL / 1; QBASIC; PASCAL; C; C++;
FOURTH GENERATION LANGUAGESFOURTH GENERATION LANGUAGES
SYSTEM SOFTWARE
APPLICATION SOFTWARE
8/8/2019 Languages and Os
25/38
Operating SystemOperating System
Interface managerInterface manager
Human interaction made easyHuman interaction made easy
interfacing, abstraction, controlinterfacing, abstraction, controland sharingand sharing Resource managerResource manager
Efficient use of resourcesEfficient use of resources System and data security andSystem and data security and
protection provider.protection provider. Control program that prevents theControl program that prevents the
system from improper use and takessystem from improper use and takescare of error situationscare of error situations
A system software that acts as an intermediary between theA system software that acts as an intermediary between theuser and the computer and works asuser and the computer and works as
8/8/2019 Languages and Os
26/38
Jobs of an O.S. : Providing UserJobs of an O.S. : Providing User
Interface Interface
Operating system provides these facilities for the user:Operating system provides these facilities for the user:
Program creation : editors, debuggers, otherProgram creation : editors, debuggers, otherdevelopment tools.development tools.
Program execution : load, files, IO operations.Program execution : load, files, IO operations. Access to IO devices: Read and writes.Access to IO devices: Read and writes.
Controlled access to files: protection mechanisms,Controlled access to files: protection mechanisms,abstraction of underlying device.abstraction of underlying device.
System access: Controls who can access theSystem access: Controls who can access thesystem.system.
8/8/2019 Languages and Os
27/38
Jobs of an O.S. : As a ResourceJobs of an O.S. : As a Resource
Manager.Manager.
Processors : Allocation of processes to processors,Processors : Allocation of processes to processors,preemption, scheduling.preemption, scheduling.
Memory: Allocation of main memory.Memory: Allocation of main memory. IO devices : when to access io devices, which onesIO devices : when to access io devices, which ones
etc.etc. Files: Partitions, space allocation and maintenance.Files: Partitions, space allocation and maintenance.
Process : Applications, Data, objects.Process : Applications, Data, objects.
8/8/2019 Languages and Os
28/38
Jobs of an O.S. : Providing ProtJobs of an O.S. : Providing Protectionection
and Security ..and Security .. When sharing resources, protection of the systems andWhen sharing resources, protection of the systems and
user resources from intentional as well as inadvertentuser resources from intentional as well as inadvertentmisuse.misuse.
Protection generally deals with access control. Ex:Protection generally deals with access control. Ex:Read only fileRead only file
Security deals usually with threats from outside theSecurity deals usually with threats from outside thesystem that affects the integrity and availability of thesystem that affects the integrity and availability of thesystem and information with the system.system and information with the system.
Example: username, password to access system. DataExample: username, password to access system. Dataencryption to protect information.encryption to protect information.
8/8/2019 Languages and Os
29/38
Evolution of Operating SystemEvolution of Operating System
Serial ProcessingSerial Processing
Batch ProcessingBatch Processing
MultiprogrammingMultiprogramming
Time SharingTime Sharing
Parallel SystemParallel System
Distributed SystemDistributed System
Real Time SystemReal Time System
8/8/2019 Languages and Os
30/38
Serial ProcessingSerial Processing
(Early 1950s)(Early 1950s)Typical setup:Typical setup:
Users would sign up for a time slot (e.g., 2am-3am) During that slot, had exclusive use of the computer
Must load program into memory space, overwriting old conten
Drawbacks:Drawbacks:
Inconvenient for user
Wasteful of computer time (computer was idle during setup,
debugging
8/8/2019 Languages and Os
31/38
Batch ProcessingBatch Processing( Mid 1950s)( Mid 1950s)
Typical setup:Typical setup:
Users would submit jobs on
cards/tape to computer operator
Operator would combine multiple
jobs into a single batch job and load
into card/tape reader Each user job would be executed in
turn
Users received output after alljobs
finished
the primitive operating system incharge of executing the batch job was
called a resident monitor
it residedpermanently in memory
it monitoredthe execution of each job in
succession
8/8/2019 Languages and Os
32/38
MultiprogrammingMultiprogramming(Early 1960s)(Early 1960s)
Typical setup:Typical setup:
Users submitted jobs to computer operatorJobs were loaded into separate memory partitionsComputer would begin executing first jobDuring idle period, could switch to another jobUser could receive output as soon as their job terminated
8/8/2019 Languages and Os
33/38
Advantages:Advantages:
Interactive ness is restored.
CPU is kept busy.
Disadvantages:Disadvantages:
Hardware and O.S. required
become significantly more complex
Advantages and Drawbacks Advantages and Drawbacks
8/8/2019 Languages and Os
34/38
Content of Primary Memory inContent of Primary Memory in
Single/Multi program systemsSingle/Multi program systems
OPERA
TING
SYSTEM
OPERA
TING
SYST
EM
UNUSED MEMORYUNUSED MEMORY
PROGRAM 1PROGRAM 1
TRADITIONAL SINGLE-TRADITIONAL SINGLE-PROGRAM SYSTEMPROGRAM SYSTEM
OPERA
TING
SYSTEM
OPERA
TING
SYST
EM
UNUSED MEMORYUNUSED MEMORY
PROGRAM 1PROGRAM 1
PROGRAM 2PROGRAM 2
PROGRAM 3PROGRAM 3
MULTIPROGRAMMINGMULTIPROGRAMMINGENVIRONMENTENVIRONMENT
8/8/2019 Languages and Os
35/38
Typical setupTypical setup::
Many users share large capacity CPU: Time in CPU divided into slices ( e.g.,2 milliseconds) Each user has access to CPU during slice. If the job is not completed within the given time slice, it
is preempted and the next job gets the CPU. The preempted jobs gets the CPU back after all other
jobs get a chance to get the CPU
7.11
Time SharingTime Sharing(Mid 1960s)(Mid 1960s)
8/8/2019 Languages and Os
36/38
New computer architectures new demandsMultiprocessor Systems ( parallel systems or tightly
coupled systems) More than one processor in close communication, share
bus and clock, other resources Can increase throughput, save on shared resources, provide
greater reliability
Distributed systems ( loosely coupled systems)Distributed systems ( loosely coupled systems) Distribute the computation among several processors, each
with its own memory & resources Processors communicate via communications lines, e.g.,
high-speed buses or phone lines Similar benefits as multiprocessor, but generally simpler,
cheaper, more scaleable but slower.
New architectures (cont )
8/8/2019 Languages and Os
37/38
New architectures (cont.)
Real-time systems
Some systems impose well-defined, fixed-time constraints
where large number of events external to the system arerequired to be taken care of.
e.g., control for scientific experiments, medical imaging
systems, industrial control systems.
Hard real-time: Critical tasks must be completed in specified time Secondary storage limited or absent, data stored in short term
memory or ROM Not compatible with timesharing
Soft real-time: Critical tasks are given priority over other tasks, but no
guarantees Limited utility in industrial control of robotics
8/8/2019 Languages and Os
38/38