免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 995 | 回复: 0
打印 上一主题 下一主题

《零基础学习Liunx之二》 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-14 10:02 |只看该作者 |倒序浏览
The following takes place between 02:00PM and 03:00PMpreviously on 零基础学习Liunx:
    上一次写到init进程启动getty,getty启动通过login验证用户名以及密码,若正确,则启动shell。
4.当你从shell中运行某个program时,计算机在做什么?
    shell是用户与系统内核之间进行交互的接口,shell与内核是通过"系统调用"来实现通信的。这样做的好处是可以在不同的情况下使用不同的shell。
    在boot之后,计算机中有许多进程,它们等待相应的事件被触发。例如,网络数据包的到达。
内核就是这些进程之一。但是它是特殊的,因为它控制了其他的 用户进程,并且它是唯一可以直接访问硬件的进程。当用户进程需要访问这些硬件资源的时候,需要通过系统调用来实现。
基本上所有的I/O操作都要通过内核实现,因此内核便可以对这些操作进行调度。但有一些例外,比如X-SERVERS。
shell只是一个普通的用户进程。
举例:Let's say you type ‘ls’ and Enter to invoke the Unix directory
lister. The shell applies its built-in rules to figure out that you
want to run the executable command in the file /bin/ls. It makes a
system call asking the kernel to start /bin/ls as a new child process
and give it access to the screen and keyboard through the kernel. Then
the shell goes to sleep, waiting for ls to finish.
When /bin/ls is done, it tells the kernel it's finished by issuing an
exit system call. The kernel then wakes up the shell and tells it it
can continue running. The shell issues another prompt and waits for
another line of input.
译:假设我们现在使用'ls'命令来查看文件目录。shell通过系统调用告诉内核启动一个子进程'/bin/ls',并且让它能够访问屏幕和键盘。这时候,shell进程进入sleep状态,等待ls完成。
当ls完成以后,它通过exit系统调用通知内核。shell被唤醒。
5.中断工作的原理
    对于每个中断,都会有一个对应的中断处理器,是操作系统的一部分。
    每个中断都有相应的优先级,高优先级可以抢占低优先级中断。
    每个中断都有自己的IRQ numbers,当不同的设备试图使用相同的IRQ中断号时,便会出现错误。
6.计算机如何同时作许多事情?
    简单的说就是利用时分复用的机制,CPU快速切换各个任务。
Unix在设计之初就加入了多任务的概念,因此它在这方面相比起Windows以及Mac OS出色很多。

To be continued........
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/93647/showart_1862893.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP