《现代操作系统》精读与思考笔记 第八章 多处理机系统 第九章 安全
2015-08-12 00:01
597 查看
《现代操作系统》精读与思考笔记 第八章 多处理机系统 第九章 安全
两章虽然篇幅不小,不过都是以介绍为主,这部分不是我读这本书的重点,看得比较粗略,笔记内容也不多,干脆合二为一。
第八章 多处理机系统
正如章节名,这章主要是关于多处理机、多计算机、虚拟化、分布式系统。由于非单机的多处理器系统和网络通信关系密切,还讲了一些计算机网络的内容。
1.非阻塞send系统调用的缺点(P556)
虽然非阻塞send()可以立即返回,而不是像阻塞版本那样可能会导致CPU空转,但是它有一个严重缺点:send所使用的缓冲区,直到发送工作完成后才能修改。如果系统不知道什么时候发送完成,那么这个缓冲区就不能确定它重新变为可用的时机。
这个原理可以类似地适用于其他的一些非阻塞版本系统调用(不过recieve的情况简单些)。非阻塞系统调用并非完美,这是我从前的误区。
当然,操作系统设计时可以回避这个问题,原书提到了三种:复制到内核由内核发送、发送后通知进程、缓冲区做只读标记并在写时复制。三者也有各自的缺陷,简单可以对应的概括为:复制到内核开销、处理同步带来的编程困难、缓冲区管理复杂,具体的解释可以参考P557。
习题
11.Suppose that the TSL instruction was not available for synchronizing a multiprocessor. Instead, another instmction, SWP, was provided that atomically swapped the contents of a register with a word in memory. Could that be used to provide multiprocessor synchronization? If so, how could it be used? If not, why does it not work?
译:
假设不能在多处理器同步问题中使用TSL指令(Test and Set Lock),而是提供了一个可以交换寄存器和存储器中一个字的SWP指令,可以用来处理多处理器同步问题吗?
Answer:
It is just as good as TSL . It is used by preloading a 1 into the register to be used. Then that register and the memory word are atomically swapped. After the instruction, the memory word is locked (i.e., has a value of 1). Its previous value is now contained in the register. If it was previously locked, the
word has not been changed and the caller must loop. If it was previously unlocked, it is now locked.
分析:
需要使用寄存器的某一个处理器将自己的一个寄存器预装载一个1,然后使用SWP交换存储器和寄存器中的内容,这个存储器字就相当于被锁上了,原先的值被送入了寄存器。如果之前已锁,那么就忙等;反之则此时上锁。
不过有个问题:如果这个存储器字初始值就是1,怎么办?按我的理解,这个存储器字是用来专门提供SWP模拟TSL功能的,“锁”的范围不限于这个单一的字。
Consider the processor allocation of Fig. 8-24. Suppose that process H is moved from node 2 to node 3. What is the total weight of the external traffic now?
译:
将图8-24中的H进程从节点2移至节点3,此时外部信息流量是多少?
分析:
这里的“移动”其实是指下面的情况,将节点2、3之间的分界线变为红线:
需要注意的是,节点1和节点3有直接相连的部分。在这个图的基础上进行分析,不难得出答案是27。
Why is there a limit to cable length on an Ethernet network?
译:
为什么以太网传输电缆有距离限制?
Answer:
Ethernet nodes must be able to detect collisions between packets, so the propagation delay between the two most widely separated nodes must be less
than the duration of the shortest packet to be sent. Otherwise the sender may fully transmit a packet and not detect a collision even though the packet suffers a collision close to the other end of the cable.
分析:
以太网需要冲突检测,因而两个最近节点的距离造成的最小包的传输延时必须小于包的生存时间。否则,即使两个临近节点也无法发现同一根电缆上冲突的存在。
在我的印象中,最大长度的原因是信号在电缆上传输的衰减,与这个答案不是很相符,两者看上去都是有道理的。
勘误
1.习题18,第二问要求计算上额外的两次复制所占用的时间,而这个时间的计算方法并没有在题目中给出,疑似遗漏。答案中这两次复制总时间是660ns。
第九章 安全
原书为了说明隐写术的页面http://www.cs.vu.nl/~art/已经404了,习题16中的网页http://www.cs.vu.nl/ast我同样打不开。
习题
Name a C compiler feature that could eliminate a large number of security holes. Why is it not more widely implemented?
译:
说出C编译器中一种通过改进可以大量减少安全漏洞的特征,为什么不这样实现编译器呢?
Answer:
The compiler could insert code on all array references to do bounds checking.This feature would prevent buffer overflow attacks. It is not done because it would slow down all programs significantly. In addition, in C it is not illegal to declare an array of size 1 as a procedure parameter and then reference element 20, but clearly the actual array whose address has been passed had better have at least 20 elements.
答案:
可以改进编译器使其对所有数组引用做边界检查,这样缓冲区溢出攻击将被消除。不这样做的原因是这将明显拖慢所有程序。并且,在C中生命一个大小为1的数组并引用它的20号元素是合法的,虽然这么做(引用第20个元素)最好还是用一个至少有20个元素的数组。
When a ftle is removed, its blocks are generally put back on the free list, but they are not erased. Do you think it would be a good idea to have the operating system erase each block before releasing it? Consider both security and performance factors in your answer, and explain the effect of each.
译:
删除文件时,文件块被放回空闲块列表,但并没有被清除。你认为让操作系统在释放之前先清除每个文件块是好方法吗?从安全性和性能分别考虑,并解释效果。
Answer:
From a security point of view, it would be ideal. Used blocks sometimes are exposed, leaking valuable information. From a performance point of view,zeroing blocks wastes CPU time, thus degrading performance.
分析:
不清除有可能泄露重要信息,但是性能比较好;反之则降低了性能。注意答案中,结合上下文来理解,”ideal”应为”unideal”。
中文版勘误
1.P353图9-17,F1对于用户B应标为”R”而非”A”;
2.P357图9-11,为了与上下文一致,“可信计算基准”应为“可信计算基”;
3.P382“内存驻留病毒”第一段第三行,“中断变量”应为“中断向量”。
作者:五岳
出处:http://www.cnblogs.com/wuyuegb2312
对于标题未标注为“转载”的文章均为原创,其版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
两章虽然篇幅不小,不过都是以介绍为主,这部分不是我读这本书的重点,看得比较粗略,笔记内容也不多,干脆合二为一。
第八章 多处理机系统
正如章节名,这章主要是关于多处理机、多计算机、虚拟化、分布式系统。由于非单机的多处理器系统和网络通信关系密切,还讲了一些计算机网络的内容。
1.非阻塞send系统调用的缺点(P556)
虽然非阻塞send()可以立即返回,而不是像阻塞版本那样可能会导致CPU空转,但是它有一个严重缺点:send所使用的缓冲区,直到发送工作完成后才能修改。如果系统不知道什么时候发送完成,那么这个缓冲区就不能确定它重新变为可用的时机。
这个原理可以类似地适用于其他的一些非阻塞版本系统调用(不过recieve的情况简单些)。非阻塞系统调用并非完美,这是我从前的误区。
当然,操作系统设计时可以回避这个问题,原书提到了三种:复制到内核由内核发送、发送后通知进程、缓冲区做只读标记并在写时复制。三者也有各自的缺陷,简单可以对应的概括为:复制到内核开销、处理同步带来的编程困难、缓冲区管理复杂,具体的解释可以参考P557。
习题
11.Suppose that the TSL instruction was not available for synchronizing a multiprocessor. Instead, another instmction, SWP, was provided that atomically swapped the contents of a register with a word in memory. Could that be used to provide multiprocessor synchronization? If so, how could it be used? If not, why does it not work?
译:
假设不能在多处理器同步问题中使用TSL指令(Test and Set Lock),而是提供了一个可以交换寄存器和存储器中一个字的SWP指令,可以用来处理多处理器同步问题吗?
Answer:
It is just as good as TSL . It is used by preloading a 1 into the register to be used. Then that register and the memory word are atomically swapped. After the instruction, the memory word is locked (i.e., has a value of 1). Its previous value is now contained in the register. If it was previously locked, the
word has not been changed and the caller must loop. If it was previously unlocked, it is now locked.
分析:
需要使用寄存器的某一个处理器将自己的一个寄存器预装载一个1,然后使用SWP交换存储器和寄存器中的内容,这个存储器字就相当于被锁上了,原先的值被送入了寄存器。如果之前已锁,那么就忙等;反之则此时上锁。
不过有个问题:如果这个存储器字初始值就是1,怎么办?按我的理解,这个存储器字是用来专门提供SWP模拟TSL功能的,“锁”的范围不限于这个单一的字。
Consider the processor allocation of Fig. 8-24. Suppose that process H is moved from node 2 to node 3. What is the total weight of the external traffic now?
译:
将图8-24中的H进程从节点2移至节点3,此时外部信息流量是多少?
分析:
这里的“移动”其实是指下面的情况,将节点2、3之间的分界线变为红线:
需要注意的是,节点1和节点3有直接相连的部分。在这个图的基础上进行分析,不难得出答案是27。
Why is there a limit to cable length on an Ethernet network?
译:
为什么以太网传输电缆有距离限制?
Answer:
Ethernet nodes must be able to detect collisions between packets, so the propagation delay between the two most widely separated nodes must be less
than the duration of the shortest packet to be sent. Otherwise the sender may fully transmit a packet and not detect a collision even though the packet suffers a collision close to the other end of the cable.
分析:
以太网需要冲突检测,因而两个最近节点的距离造成的最小包的传输延时必须小于包的生存时间。否则,即使两个临近节点也无法发现同一根电缆上冲突的存在。
在我的印象中,最大长度的原因是信号在电缆上传输的衰减,与这个答案不是很相符,两者看上去都是有道理的。
勘误
1.习题18,第二问要求计算上额外的两次复制所占用的时间,而这个时间的计算方法并没有在题目中给出,疑似遗漏。答案中这两次复制总时间是660ns。
第九章 安全
原书为了说明隐写术的页面http://www.cs.vu.nl/~art/已经404了,习题16中的网页http://www.cs.vu.nl/ast我同样打不开。
习题
Name a C compiler feature that could eliminate a large number of security holes. Why is it not more widely implemented?
译:
说出C编译器中一种通过改进可以大量减少安全漏洞的特征,为什么不这样实现编译器呢?
Answer:
The compiler could insert code on all array references to do bounds checking.This feature would prevent buffer overflow attacks. It is not done because it would slow down all programs significantly. In addition, in C it is not illegal to declare an array of size 1 as a procedure parameter and then reference element 20, but clearly the actual array whose address has been passed had better have at least 20 elements.
答案:
可以改进编译器使其对所有数组引用做边界检查,这样缓冲区溢出攻击将被消除。不这样做的原因是这将明显拖慢所有程序。并且,在C中生命一个大小为1的数组并引用它的20号元素是合法的,虽然这么做(引用第20个元素)最好还是用一个至少有20个元素的数组。
When a ftle is removed, its blocks are generally put back on the free list, but they are not erased. Do you think it would be a good idea to have the operating system erase each block before releasing it? Consider both security and performance factors in your answer, and explain the effect of each.
译:
删除文件时,文件块被放回空闲块列表,但并没有被清除。你认为让操作系统在释放之前先清除每个文件块是好方法吗?从安全性和性能分别考虑,并解释效果。
Answer:
From a security point of view, it would be ideal. Used blocks sometimes are exposed, leaking valuable information. From a performance point of view,zeroing blocks wastes CPU time, thus degrading performance.
分析:
不清除有可能泄露重要信息,但是性能比较好;反之则降低了性能。注意答案中,结合上下文来理解,”ideal”应为”unideal”。
中文版勘误
1.P353图9-17,F1对于用户B应标为”R”而非”A”;
2.P357图9-11,为了与上下文一致,“可信计算基准”应为“可信计算基”;
3.P382“内存驻留病毒”第一段第三行,“中断变量”应为“中断向量”。
作者:五岳
出处:http://www.cnblogs.com/wuyuegb2312
对于标题未标注为“转载”的文章均为原创,其版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
相关文章推荐
- 应用领航:盘点那些年我们一起追过的OS
- 分布式版本管理git入门指南使用资料汇总及文章推荐
- 无奇不有!盘点各国自己开发的操作系统
- 可自定义oem的萝卜家园 Ghost XP 新春装机版 V200801 下载
- C#分布式事务的超时处理实例分析
- C#实现判断操作系统是否为Win8以上版本
- Erlang分布式节点中的注册进程使用实例
- 笔记本下什么是迅驰处理器(cpu)相关资料第1/2页
- Linux操作系统添加新硬盘方法
- java如何获取本地操作系统进程列表
- Linux rdesktop操作系统下远程登录Windows XP桌面
- 32位操作系统认出超出4G内存的方法
- Linux rpm tar 操作系统下软件的安装与卸载方法
- JavaScript 获取用户客户端操作系统版本
- jsp 获取客户端的浏览器和操作系统信息
- Windows 操作系统的安全设置
- PHP获取用户的浏览器与操作系统信息的代码
- C++实现的分布式游戏服务端引擎KBEngine详解
- Perl操作系统环境变量的脚本代码
- 封装好的js判断操作系统与浏览器代码分享