当前位置首页 > 百科> 正文

module

2019-07-10 17:13:41 百科
module

module

module,意思是宇宙飞船的分离舱。n. [计] 模组;组件;模数。[网路] 模组;模;模组。[专业] 模组 [计算机科学技术];模组 [电子、通信与自动控制技术];构件 [农业科学]。

基本介绍

  • 外文名:module
  • 发音: [ 'mɔdju:l ]
  • 简介:宇宙飞船的分离舱
  • 例句:evel programs or modules.

单词词义

module: [ 'mɔdju:l ]
1.[计算机] 模组
n. 组件
2. 单元【课程学习单元】
a module in mathematics数学课的一个单元
3.宇宙飞船的分离舱

例句用法

1. In software engineering, an individual unit or module that is utilized by higher-level programs or modules.
在软体工程中,指较高一级程式或模组使用的一个单元或模组。
2. Object repository support for creating shared, reusable form and data module.
用于创建共享、可重用窗体和数据模组的对象储存库支持。
3. The definition of a global symbol that is not explicitly available for reference by modules linked with the module in which the definition occurs.
一种全局符号定义,它不能被与定义该全局符号的模组相连结的其它模组直接引用。
4. My desk is my command module.
我的书桌就是我的主要工作场所。

英英解释

名词module:
1. one of the inherent cognitive or perceptual powers of the mind
同义词:faculty, mental faculty
2. detachable compartment of a spacecraft
3. computer circuit consisting of an assembly of electronic components (as of computer hardware)
4. a self-contained component (unit or item) that is used in combination with other components

同名软体

Linux modules是linux 2.0版本以后都支持模组化,因为核心中的一部分常驻在记忆体中,(如最常使用的进程,如scheduler等),但是其它的进程只是在需要的时候才被载入。如MS-DOS档案系统只有当mount此类系统的时候才需要,这种按需载入,就是模组。它能使核心保持较小的体积,虽然可以把所有的东东都放在核心中,这样的话,我们就不需要模组了,但是这样通常是有特殊的用途(所有要运行的进程都预先知道的情况)。
模组另一个优点是核心可以动态的载入、卸载它们(或者自动地由kerneld守护程式完成)。
Writing, Installing, and Removing Modules
WRiting Modules:
除了它们运行在核心空间中之外,模组与其它程式类似。所以,必须定义MODULE并且包含头档案module.h以及其它的一些核心头档案。模组即可以很简单也可以很複杂。
一般的模组格式如下:
#define MODULE#include<linux/module.h>    /*...otherrequiredheaderfiles...*/    /**...moduledeclarationsandfunctions...*/intinit_module(){    /*codekernelwillcallwheninstallingmodule*/}    voidcleanup_module(){    /*codekernelwillcallwhenremovingmodule*/}
使用核心源码的模组在用gcc编译时,必须使用如下的选项:
-I/usr/src/linux/include
注意并不是所有核心中的变数都被导出供模组使用的,即使代码中用extern声明了。在/proc/ksyms档案或者程式ksyms中显示了被导出的符号。linux核心使用使用EXPORT_SYMBOL(x)宏来不仅导出符号,而且也导出版本号(version number)。如果是用户自己定义的变数,使用EXPORT_SYMBOL_NOVERS(x)宏。否则的话linker不会在kernel symbol table中保留此变数。可以使用EXPORT_NO_SYMBOLS宏不导出变数,预设情况是模组导出所有的变数。
InstallingandRemovingModules:
必须是超级用户才可以的。使用insmod来安装一个模组:
/sbin/insmodmodule_name
rmmod命令移除一个已经安装了的模组,以及任何此模组所导出的引用。
/sbin/rmmodmodule_name
使用lsmod列出所有安装了的模组。
Example:
simple_module.c
/*simple_module.c**Thisprogramprovidesanexampleofhowtoinstallatrivialmodule*intotheLinuxkernel.Allthemoduledoesisputamessageinto*thelogfilewhenitisinstalledandremoved.**/#defineMODULE#include<linux/module.h>/*kernel.hcontainstheprintkfunction*/#include<linux/kernel.h>/*init_module*kernelcallsthisfunctionwhenitloadsthemodule*/intinit_module(){printk("<1>Thesimplemoduleinstalleditselfproperly./n");return0;}/*init_module*//*cleanup_module*thekernelcallsthisfunctionwhenitremovesthemodule*/voidcleanup_moudle(){printk("<1>Thesimplemoduleisnowuninstalled./n");}/*cleanup_module*/ThisistheMakefile:#Makefileforsimple_moduleCC=gcc-I/usr/src/linux/include/configCFLAGS=-O2-D__KERNEL__-Wallsimple_module.o:simple_module.cinstall:/sbin/insmodsimple_moduleremove:/sbin/rmmodsimple_module
声明:此文信息来源于网络,登载此文只为提供信息参考,并不用于任何商业目的。如有侵权,请及时联系我们:baisebaisebaise@yeah.net