lesson 1 how a program executes 2015
DESCRIPTION
Lesson 1 How a Program Executes 2015TRANSCRIPT
![Page 1: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/1.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 1/22
Operating system
• What is an operating system? Some definitions:
• A program that is executed by the processor thatfrequently relinquishes control and must dependon the processor to regain control.
• A program that mediates between application
programs and the hardware
• A set of procedures that enable a group of peopleto use a computer system.A program that controls the execution of
application programs• An interface between applications and hardware
![Page 2: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/2.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 2/22
What is a program?
• A sequence of steps
• For each step an arithmetic or logicaloperation is done
• For each operation a different set of
control signals is needed
![Page 3: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/3.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 3/22
Function of Control Unit
• For each operation a unique code ispro!ided
"e.g. A## $%&'
• A hardware segment accepts the code and
issues the control signals
• We ha!e a computer(
![Page 4: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/4.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 4/22
Components
• )he *ontrol +nit and the Arithmetic and,ogic +nit constitute the *entral-rocessing +nit
• #ata and instructions need to get into the
system and results out"nput/output
• )emporary storage of code and results isneeded
"$ain memory
![Page 5: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/5.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 5/22
Computer Components:
Top Level View
![Page 6: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/6.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 6/22
How a program wors
• #ata and instructions are stored in asingle read0write memory
• )he contents of this memory areaddressable by location
• 'xecution occurs in a sequentialfashion1normally2 from one instruction tothe next.
![Page 7: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/7.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 7/22
!nstruction Cycle
• )wo steps:
"Fetch
"'xecute
![Page 8: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/8.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 8/22
Fetch Cycle
• -rogram *ounter 1-*2 holds address ofnext instruction to fetch
• -rocessor fetches instruction frommemory location pointed to by -*
• ncrement -*"+nless told otherwise
• nstruction loaded into nstruction3egister 132
• -rocessor interprets instruction andperforms required actions
![Page 9: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/9.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 9/22
Four main categories of instructions
• -rocessor0memory
"data transfer between *-+ and main memory
• -rocessor /%
"#ata transfer between *-+ and /% module
• #ata processing"Some arithmetic or logical operation on data
• *ontrol
"Alteration of sequence of operations"e.g. 4ump
![Page 10: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/10.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 10/22
"#ample of $rogram "#ecution
![Page 11: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/11.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 11/22
!nterrupts
• $echanism by which other modules 1e.g./%2 may interrupt normal sequence ofprocessing 1fetch 5 execute cycle2
• -rogram
"e.g. o!erflow di!ision by 6ero• )imer
"7enerated by internal processor timer
"+sed in pre0empti!e multi0tas8ing
• /%
"from /% controller
• 9ardware failure
"e.g. memory parity error
![Page 12: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/12.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 12/22
$rogram Flow Control
![Page 13: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/13.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 13/22
!nterrupt Cycle
• Added to instruction cycle
• -rocessor chec8s for interrupt
"ndicated by an interrupt signal
• f no interrupt fetch next instruction
• f interrupt pending:"Suspend execution of current program
"Sa!e context
"Set -* to start address of interrupt handlerroutine
"-rocess interrupt
"3estore context and continue interrupted
program
![Page 14: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/14.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 14/22
Transfer of Control via !nterrupts
![Page 15: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/15.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 15/22
!nstruction Cycle with !nterrupts
![Page 16: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/16.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 16/22
$rogram Timing
%hort !&O Wait
![Page 17: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/17.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 17/22
!nstruction Cycle 'with !nterrupts( )
%tate *iagram
![Page 18: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/18.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 18/22
![Page 19: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/19.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 19/22
Changes in Memory and Registers for anInterrupt
![Page 20: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/20.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 20/22
Changes in Memory and Registers for anInterrupt
![Page 21: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/21.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 21/22
+ultiple !nterrupts
• #isable interrupts
"-rocessor will ignore further interrupts whilstprocessing one interrupt
"nterrupts remain pending and are chec8edafter first interrupt has been processed
"nterrupts handled in sequence as they occur
• #efine priorities
",ow priority interrupts can be interrupted by
higher priority interrupts"When higher priority interrupt has been
processed processor returns to pre!iousinterrupt
![Page 22: Lesson 1 How a Program Executes 2015](https://reader034.vdocument.in/reader034/viewer/2022051118/5695cf8f1a28ab9b028e9aaf/html5/thumbnails/22.jpg)
7/21/2019 Lesson 1 How a Program Executes 2015
http://slidepdf.com/reader/full/lesson-1-how-a-program-executes-2015 22/22
+ultiple !nterrupts ) %e,uential