









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
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
1 / 16
This page cannot be seen from the preview
Don't miss anything!










int a, b, c, d;
... a = b + c; d = a - 100;
; 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
; 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
10111001001100โฆ 10111001010000โฆ 10100111001100โฆ 10111010001100โฆ 10111001010000โฆ 10100110001100โฆ 10111001101100โฆ
Data might be fetched as a result of execution
:
2 ;
=
>$#?
int a, b, c, d;
... a = b + c; d = a - 100;
; 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
@
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
while device_flag busy {}
5 #&- # #2&"#
while (Flag != write) { sleep( X ) }
3 -$"%"-" #"
issues โwriteโ
This is Interrupt-driven
" 2 -3>+ 4 ,?
PC =
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 =
=
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( &# #<^ 0 <F% <