Lecture4 - COP 5611 Operating Systems Spring 2010 Dan C....

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COP 5611 Operating Systems Spring 2010 Dan C. Marinescu Office: HEC 439 B Office hours: M-Wd 2:00-3:00 PM 2 Lecture 4 Last time: Names and three basic abstractions Today: Soft modularity Procedure call conventions Memory map Errors and soft-modularity Enforcing modularity with clients and services Communication with messages isolates modules. Case studies: WWW, X11 Heterogeneity Intermediaries Remote Procedure Calls Domain Name Service (DNS) Virtualization Soft modularity Soft modularity divide a program in procedures that call each other. Hard to debug; if one of the modules has an infinite loop, a call never returns The caller and the callee are in the same address space and may misuse the stack. Naming conflicts and wrong context specification. Procedure call convention 1. Caller 1. saves on the stack (after each operation it adjusts the Stack Pointer -SP) 1. registers 2. arguments 3. return address 2. transfers control to the calle (jump to its starting address) 2. Calee 1. loads from the stack the arguments 2. carries out the desired calculation and load the results in a register (R0) 3. transfers control back to the caller loads in the PC the return address to the caller 3. Caller 1. adjusts the stack 2. restores its registers text stack data Example: procedure MEASURE (func) start_time GET_TIME(SECONDS) funct() end_time GET_TIME(SECONDS) return (end_time-start_time) procedure GET_TIME (units) time CLOCK time CONVERT_TO_UNITS(time,units) return time 6 Machine code for MEASURE 100 ST R1,SP //save content of R1 on the stack 104 ADD 4, SP //increment stack pointer 108 ST R2, SP //save content of R2 on the stack 112 ADD 4, SP //increment stack pointer 116 LA R1, SECONDS //load address of the argument in R1 120 ST R1, SP // store address of the argument on the stack 124 ADD 4, SP // increment stack pointer 128 L A R1,148 // load return address in R1 132 ST R1, SP // store return address on the stack 136 ADD 4, SP //adjust top stack pointer 140 L A R1, 200 // load address of GET_TIME in R1 144 JMP R1 //transfer control to GET_TIME 148 S 4,SP // decrement stack pointer 152 L R2, SP // restore the contents of R2 156 S 4,SP // decrement stack pointer 160 L R1,SP // restore the contents of R1 164 S 4,SP // decrement stack pointer 168 ST R0, start // store result passed by GET_TIME in Ro into start 7 Machine code for GET_TIME 200 L R1,SP //load address of the stack pointer in R1 204 S R1,8 //increment stack pointer 208 L R2, R1 //load address of the argument in R2 212 code for the body of GET_TIME 216 code for the body of GET_TIME 220 L R0, time // load in R0 the result 224 L R1,SP // reload in R1 address of the stack pointer 228 S R1,4 // decrement the stack pointer 231 L PC,R1 // load return address from stack into PC 8 Soft modularity allows errors to propagate Conventions between caller and callee regarding register usage: The caller passes the argument (the address of the variable SECONDS)...
View Full Document

Page1 / 40

Lecture4 - COP 5611 Operating Systems Spring 2010 Dan C....

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online