设x和y当前值分别为100,100,现有事务T1和T2,其操作如下:T1:read(x) x:=x-50 write(x) read(y) y:=y+50 write(y) T2: read(x) temp:=x*0.1 x:=x-temp write(x) read(y) y:=y+temp write(y) 请分别写出T1在前和T2在前的串行调度的结果;
时间: 2024-03-18 16:44:01 浏览: 56
假设T1在前执行,则串行调度的结果如下:
| T1 | T2 |
|------------------|------------------|
| read(x) (x=100) | |
| x:=x-50 (x=50) | |
| write(x) (x=50) | |
| read(y) (y=100) | |
| y:=y+50 (y=150) | |
| write(y) (y=150) | |
| | read(x) (x=50) |
| | temp:=x*0.1 (temp=5) |
| | x:=x-temp (x=45) |
| | write(x) (x=45) |
| | read(y) (y=150) |
| | y:=y+temp (y=155) |
| | write(y) (y=155) |
假设T2在前执行,则串行调度的结果如下:
| T2 | T1 |
|------------------|------------------|
| read(x) (x=100) | |
| temp:=x*0.1 (temp=10) | |
| x:=x-temp (x=90) | |
| write(x) (x=90) | |
| read(y) (y=100) | |
| y:=y+temp (y=110) | |
| write(y) (y=110) | |
| | read(x) (x=90) |
| | x:=x-50 (x=40) |
| | write(x) (x=40) |
| | read(y) (y=110) |
| | y:=y+50 (y=160) |
| | write(y) (y=160) |
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![ppt](https://img-home.csdnimg.cn/images/20210720083527.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)