(莱昂氏unix源代码分析导读-34)You are not expected to understand this

 

                                                                  By cszhao1980

本章将探讨unix v6代码中最微妙的部分,即著名的注释:“ You are not expected to understand this”。

 

2178: swtch()

2179: {

2180:     static struct proc *p;

2181:     register i, n;

2182:     register struct proc *rp;

          ……

2228:     retu(rp->p_addr);

2229:     sureg();

2230: /*

2231: * If the new process paused because it was

2232: * swapped out, set the stack level to the last call

2233: * to savu(u_ssav). This means that the return

2234: * which is executed immediately after the call to aretu

2235: * actually returns from the last routine which did

2236: * the savu.

2237: *

2238: * You are not expected to understand this.

2239: */

2240:     if(rp->p_flag&SSWAP) {

2241:         rp->p_flag =& ~SSWAP;

2242:         aretu(u.u_ssav);

2243:     }

2244: /* The value returned here has many subtle implications.

2245: * See the newproc comments.

2246: */

2247:     return(1);

2248: }

 

相关代码仅有三行,逻辑非常简单:

(1)         swtch()退出之前,会检查进程的<

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值