• No results found

Prof. R K Joshi

N/A
N/A
Protected

Academic year: 2022

Share "Prof. R K Joshi"

Copied!
32
0
0

Loading.... (view fulltext now)

Full text

(1)

Concepts

Prof. R K Joshi

CSE, IIT Bombay

(2)

Source Program

a=1;

b=2;

a=a+b;

cout << a;

(3)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2 add R1 and R2, result in R1

move R1 to address M1 move M1 to DisplayBuffer R2

(4)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2 add R1 and R2, result in R1

move R1 to address M1 move M1 to DisplayBuffer R2

(5)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

(6)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

(7)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

(8)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

move $1 to address M1

(9)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

move $1 to address M1

(10)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2 11

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

(11)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

move $2 to address M2

(12)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2 11

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

move $2 to address M2

(13)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer 2 R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

(14)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2 11

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

move M1 to register R1

(15)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer 2 R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

move M1 to register R1

(16)

1

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2 11

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

(17)

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer 2 R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

move M2 to register R2

(18)

1 2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2 11

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

move M2 to register R2

(19)

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer 2 R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

(20)

1 2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2 11

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

add R1 and R2, result in R1

(21)

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer 2 R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

add R1 and R2, result in R1

(22)

3 2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2 11

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

(23)

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer 2 R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

move R1 to address M1

(24)

3 2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2 33

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

move R1 to address M1

(25)

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer 2 R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

(26)

3 2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2 33

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffe

(27)

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer 2 R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

move M1 to DisplayBuffer

(28)

3 2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

R2 33

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

move M1 to DisplayBuffer

3

(29)

2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer 2 R2

move $1 to address M1 move $2 to address M2 move M1 to register R1 move M2 to register R2

add R1 and R2, result in R1 move R1 to address M1 move M1 to DisplayBuffer

3 how to terminate???

(30)

Finally, think about these points:

1. Identify the registers shown in the pictures

2. Add an example to show how loops will be executed

3. Does the exact scheme shown in the slides work when there are loops (esp. note how program proceeds with the next instruction)?

4. What do we need to save when the context is to be switched?

(i.e. when we want to let some other process run for some time) 5. The line with cout results in calling a subprogram which is not shown. How can this be achieved?

6. How does one terminate such a program?

7. Where does an OS come into picture?

(31)

1. What happens when a compiler is compiling a program which is possibly changed, and it is also being simultaneously executed

with the old executable file.. will you see a change in behavior?

Why?

2. When we compile a program and then execute it, is the

executable picked up straight from memory where the executable code is first available as a result of compilation process which

happens in main memory?

3. Is the compiler itself also an executable process just like the one

that we discussed through these slides?

(32)

Summary of Main Concepts Covered today Programs vs. processes

Register Memory vs. Main Memory

CPU, Instructions, Computation, Memory addresses

Reason for distinguishing between actual and compiler generated memory addresses

Program Counter Context Switching Process Control Block

Timer interrupt

References

Related documents

• policy planning, land reform, natural resources management, climate change, agricultural production, value chains development, employment creation and food

While policies after the COVID-19 pandemic should support business efforts to build more resilient supply chains, equating localization or shortening of supply

passive solar or or active solar active solar depending on the way depending on the way they capture, convert and distribute solar energy.. they capture, convert and

Corporations such as Coca Cola (through its Replenish Africa Initiative, RAIN, Reckitt Benckiser Group and Procter and Gamble have signalled their willingness to commit

For details, contact concerned Mandal Agricultural officer, Divisional Assistant Director of Agriculture and district Joint Director of

It seems, therefore, important at the outset, before treating the more specific aspects of the topic of this article, to look for the main factors which have l e d

INDEPENDENT MONITORING BOARD | RECOMMENDED ACTION.. Rationale: Repeatedly, in field surveys, from front-line polio workers, and in meeting after meeting, it has become clear that

Section 2 (a) defines, Community Forest Resource means customary common forest land within the traditional or customary boundaries of the village or seasonal use of landscape in