@Radon
2015-01-05T09:08:59.000000Z
字数 1143
阅读 1754
1100012749
A. 0 0 0 0 1 0 0 1 1 1 1 1 0 0
B.
| Parameter | Value |
|---|---|
| VPN | 0X09 |
| TLB index | 0x1 |
| TLB tag | 0x02 |
| TLB hit? | N |
| Page fault? | N |
| PPN | 0x17 |
C.
0 1 0 1 1 1 1 1 1 1 0 0
D.
| Parameter | Value |
|---|---|
| Byte offset | 0x0 |
| Cache index | 0xf |
| Cache tag | 0x17 |
| Cache hit? | N |
| Cache byte returned | - |
A. 0 0 0 0 1 1 1 0 1 0 1 0 0 1
B.
| Parameter | Value |
|---|---|
| VPN | 0x0e |
| TLB index | 0x2 |
| TLB tag | 0x03 |
| TLB hit? | N |
| Page fault? | N |
| PPN | 0x11 |
C. 0 1 0 0 0 1 1 0 1 0 0 1
D.
| Parameter | Value |
|---|---|
| Byte offset | 0x1 |
| Cache index | 0xa |
| Cache tag | 0x11 |
| Cache hit? | N |
| Cache byte returned | - |
A. 0 0 0 0 0 0 0 1 0 0 0 0 0 0
B.
| Parameter | Value |
|---|---|
| VPN | 0x01 |
| TLB index | 0x1 |
| TLB tag | 0x00 |
| TLB hit? | N |
| Page fault? | Y |
| PPN | - |
C. -
D. -
#include <fcntl.h>#include <sys/mman.h>#include <unistd.h>int main(){int fd;char *map_addr;fd = open("hello.txt", O_RDWR, NULL);map_addr = (char *) mmap(NULL, 1, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);close(fd);if (map_addr == MAP_FAILED) return -1;*map_addr = 'J';munmap(map_addr, 1);return 0;}
fd2 = 4
int main(int argc, char **argv) {int n;rio_t rio;char buf[MAXBUF];Rio_readinitb(&rio, STDIN_FILENO);while ((n = Rio_readnb(rio, buf, MAXBUF)) != 0) {Rio_write(STDOUT_FILENO, buf, n);}return 0;}
if (fork() == 0) {int fd = open("foo.txt", O_RDONLY, 0);dup2(fd, STDIN_FILENO);clode(fd);execve("fstatcheck", argv, envp);}