Computer Organization - Lecture Slides | CS 3204, Study notes of Operating Systems

Chapt 4 Material Type: Notes; Professor: Ali; Class: Operating Systems; Subject: Computer Science; University: Virginia Polytechnic Institute And State University; Term: Unknown 1989;

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-bho-1
koofers-user-bho-1 ๐Ÿ‡บ๐Ÿ‡ธ

10 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
๎˜
๎˜‚๎˜ƒ๎˜„๎˜…๎˜†๎˜‡๎˜ˆ๎˜‰๎˜Š
๎˜‚๎˜‹๎˜Œ๎˜…๎˜๎˜†๎˜‡๎˜ˆ๎˜‰๎˜Ž๎˜ˆ๎˜๎˜„๎˜๎˜‘๎˜’๎˜„๎˜†๎˜‘๎˜‹๎˜
๎˜‚๎˜“๎˜‰๎˜”๎˜•๎˜–๎˜Š๎˜‰๎˜— ๎˜˜๎˜ˆ๎˜†๎˜ƒ๎˜๎˜ˆ ๎˜•
๎˜™๎˜ˆ๎˜‹๎˜๎˜ˆ๎˜„๎˜Œ๎˜‰๎˜“๎˜…๎˜‡๎˜š๎˜‘๎˜›๎˜‘๎˜š๎˜„๎˜†๎˜‘๎˜‹๎˜
int a, b, c, d;
. . .
a = b + c;
d = a - 100;
Source
; Code for a = b + c
load R3,b
load R4,c
add R3,R4
store R3,a
Assembly Language
; Code for d = a - 100
load R4,=100
subtract R3,R4
store R3,d
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Computer Organization - Lecture Slides | CS 3204 and more Study notes Operating Systems in PDF only on Docsity!

    

int a, b, c, d;

... a = b + c; d = a - 100;

Source

; Code for a = b + c load R3,b load R4,c add R3,R store R3,a

Assembly Language

; Code for d = a - 100 load R4,= subtract R3,R store R3,d

    

; Code for a = b + c load R3,b load R4,c add R3,R store R3,a

; Code for d = a - 100 load R4,= subtract R3,R store R3,d

Assembly Language

10111001001100โ€ฆ 10111001010000โ€ฆ 10100111001100โ€ฆ 10111010001100โ€ฆ 10111001010000โ€ฆ 10100110001100โ€ฆ 10111001101100โ€ฆ

Machine Language

   

Data might be fetched as a result of execution

    :

 2 ;    

    =

 >$#?

int a, b, c, d;

... a = b + c; d = a - 100;

Source

; Code for a = b + c load R3,b load R4,c add R3,R store R3,a

Assembly Language

; Code for d = a - 100 load R4,= subtract R3,R store R3,d

    @

 2 ;     

 !#"   %& "3 9  ' 2  ' -#8#"- " #  0 2  +-#> " #  #?

   0 *&"

AB    3 9AB 3 #9#

    

/C 0*&"

' > 39?

/

    

 &2

    

 &2

 3 ##8'  9> & ## 9 #?  '9> &'#?  '>  9#?  !#"   %& "3 9

    

 &##

 MAR  MemAddr  CMD  โ€˜Read OPโ€™ > 39?  0 * MDR  Mem[ MAR ]

 MAR  MemAddr  CMD  โ€˜Write OPโ€™ > 39?  0 * Mem[ MAR ]  MDR

    

'$8'$ ""

    

'$'$

'$ ""

'$

3 

3 #

    @

'$ ""

  ""

write Prints info

    

'$'$ 3 

     

 "" 4 '$ 3 

 "" 4 '$ 3 

3 # %&        

OS could provide higher level operations to application than the one Driver presents to it

    

    • #E

while device_flag busy {}

 5 #&- # #2&"#

while (Flag != write) { sleep( X ) }

 3 -$"%"-" #" 

    

    • #ED

issues โ€œwriteโ€

This is Interrupt-driven

    

 " 2 -3>+ 4 ,?

PC = ; IR = memory[PC]; haltFlag = CLEAR; while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; if(InterruptRequest) { memory[0] = PC; PC = memory[1] };

memory[1] contains the address of the interrupt handler

    

3 + "> -?

interruptHandler() { saveProcessorState(); for(i=0; i<NumberOfDevices; i++) if(device[i].done) goto deviceHandler(i); /* something wrong if we get to here โ€ฆ */

deviceHandler(int i) { finishOperation(); returnToScheduler(); }

    :

9  

saveProcessorState() { for(i=0; i<NumberOfRegisters; i++) memory[K+i] = R[i]; for(i=0; i<NumberOfStatusRegisters; i++) memory[K+NumberOfRegisters+i] = StatusRegister[i]; }

PC = ; IR = memory[PC]; haltFlag = CLEAR; while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; if(InterruptRequest && InterruptEnabled) { disableInterupts(); memory[0] = PC; PC = memory[1] };

    =

9 $#trap 3 #>+ 4 ,?

executeTrap(argument) { setMode(supervisor); switch(argument) { case 1: PC = memory[1001]; // Trap handler 1 case 2: PC = memory[1002]; // Trap handler 2

... case n: PC = memory[1000+n];// Trap handler n };

 F# ##

 "  ""&

 F " # # ##

 I##-J

    

# (#&# ""

F ## (#&# "" ><% <%&#?

F(  &# #<^ 0 <F% <