MIT6.S081-2022-FALL

Speed up system calls (easy)

题目

Some operating systems (e.g., Linux) speed up certain system calls by sharing data in a read-only region between userspace and the kernel. This eliminates the need for kernel crossings when performing these system calls. To help you learn how to insert mappings into a page table, your first task is to implement this optimization for the getpid() system call in xv6.

阐述:

When each process is created, map one read-only page at USYSCALL (a virtual address defined in memlayout.h). At the start of this page, store a struct usyscall (also defined in memlayout.h), and initialize it to store the PID of the current process. For this lab, ugetpid() has been provided on the userspace side and will automatically use the USYSCALL mapping. You will receive full credit for this part of the lab if the ugetpid test case passes when running pgtbltest.

重点:进程的创建和释放(proc.c)、页表的构建(mappages();)

注意:调用getpid(),是在一个进程中!(不要忘记创建进程哦!)

Print a page table (easy)

难点:理解多级页表的组成与原理。对指针的理解( pte = pagetable[i])

  • eg: 一个page table directory 有多少个pte?

Detect which pages have been accessed (hard)

难点: 理解分页、walk()、walkaddr().

建议:

跟着Hint 一步一步来,由于pgtbltest不够详细,最好用vmprint()、printf()来检验效果。

  • vmprint(): 对照pte 来检验是否是1、2、30 accessed.——这里有个坑!!!

  • printf(): 打印abits等。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值