linux内核的源代码主要用什么语言
“linux内核的源代码主要用什么语言”相关的资料有哪些?“linux内核的源代码主要用什么语言”相关的范文有哪些?怎么写?下面是小编为您精心整理的“linux内核的源代码主要用什么语言”相关范文大全或资料大全,欢迎大家分享。
Linux内核源代码漫游
Linux内核源代码漫游
Linux内核源代码漫游
Linux教程-编程开发-Linux内核源代码漫游
本章试图以顺序的方式来解释Linux源代码,以帮助读者对源代码的体系结
构以及很多相关的unix特性的实现有一个很好的理解。目标是帮助对Linux 不甚了解的有经验的C程序员对整个Linux的设计有所了解。这也就是为什么内核漫游的入点选择为内核本身的启始点:系统引导(启动)。
这份材料需要对C语言以及对Unix的概念和PC机的结构有很好的了解,然
而本章中并没有出现任何的C代码,而是直接参考(指向)实际的代码的。有关内核设计的最佳篇幅是在本手册的其它章节中,而本章仍趋向于是一个非正式的概述。
本章中所参阅的任何文件的路径名都是指主源代码目录树,通常是
/usr/src/linux。
这里所给出的大多数信息都是取之于Linux发行版1.0的源代码。虽然如此,有时也会提供对后期版本的参考。这篇漫游中开头有 图标的任何小节都是强调1.0版本后对内核的新的改动。如果没有这样的小节存在,则表示直到版本1.0.9-1.1.76,没有作过改动。
有时候本章中会有象这样的小节,这是指向正确的代码以对刚讨论过的主题
取得更多信息的指示符。当然,这里是指源代码。
引导(启动)系统 当
linux 2.6内核源代码目录树简介
linux 2.6内核具有O(1)调度算法、改进的NPTL线程模型、内核态抢占等特性,以及良好的响应能力。
可以把内核源代码目录树分为系统最核心组件和系统次核心组件: 其中,系统最核心组件包括: scripts目录
该目录中不包含任何核心代码,该目录下存放了用来配置内核的脚本和应用程序源码。 lib目录
该目录主要包含两部分内容:gnuzip解压缩算法,用于在系统启动过程中将压缩的内核镜像解压缩;剩余的文件用于实现一个C库的子集,主要包括字符串和内存操作等相关函数。 mm目录
该目录包含了体系结构无关的内存管理代码,包括通用的分页模型的框架、伙伴算法的实现和对象缓冲器slab的实现代码。 include目录
这个目录包含了Linux源代码目录树中绝大部分头文件,每个体系架构都在该目录下对应一个子目录,该子目录中包含了给定体系结构所必需的宏定义和内联函数。
init目录
该目录中存放的是系统核心初始化代码,内核初始化入口函数start_kernel就是在该目录中的文件main.c内实现的。 kernel目录
该目录中存放的是Linux内核的最核心的代码,用于实现系统的核心模块,这些模块包括:进程管理、进程调度器、中断处理、系统时钟管理、同步机制
Linux0.01内核源代码及注释
Bootsect.s(1-9)
!
! SYS_SIZE is the number of clicks (16 bytes) to be loaded.
! 0x3000 is 0x30000 bytes = 196kB, more than enough for current
! versions of linux ! SYS_SIZE 是要加载的节数(16 字节为1 节)。0x3000 共为 1 2 3 4 5 6 0x7c00 0x0000 0x90000 0x10000 0xA0000 system 模块
代码执行位置线路 0x90200
! 0x30000 字节=192 kB(上面Linus 估算错了),对于当前的版本空间已足够了。 !
SYSSIZE = 0x3000 ! 指编译连接后system 模块的大小。参见列表1.2 中第92 的说明。! 这里给出了一个最大默认值。 !
! bootsect.s (C) 1991 Linus Torvalds !
! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves ! iself out of
c语言源代码
acm经典百题
#include
C语言2048源代码
#include void Generat_picture(int d[N][N],char c[N][N][N],int s); void Control_synthesis(int a[N][N]); void add_num(int a[N][N]); void swap(int *a,int *b); int score(int a[N][N]); int moveup(int a[N][N]); int movedown(int a[N][N]); int moveleft(int a[N][N]); int moveright(int a[N][N]); int main() { int d[N][N]; char c[N][N][N]; int i,j,s=2; system(\ for(i=0; i add_num(d); Generat_picture(d,c,s); Control_synthesis(d); s=score(d);
C语言串口通信-源代码
C语言串口通信-源代码
#include <stdio.h>
#include <dos.h>
#include <conio.h>
#include <string.h>
#define COM232 0x2f8
#define COMINT 0x0b
#define MaxBufLen 500
#define Port8259 0x20
#define EofInt 0x20
static int comportaddr;
static char intvectnum;
static unsigned char maskb;
static unsigned char Buffer[MaxBufLen];
static int CharsInBuf,CircIn,CircOut;
static void (interrupt far *OldAsyncInt)();
static void interrupt far AsyncInt(void);
void Init_COM(int ComPortAddr, unsigned char IntVectNum, int Baud,
un
MODBUS通讯+C语言源代码
MODBUS通讯+C语言源代码
/*********************************************************************************/
/*函数名称: strmcpy()
*输入参数: 共 个参数;
*输出参数: 共 个参数;
*返回值:
*需储存的参数: 共 个参数;
*功能介绍:
(1)字符数组拷贝;
*修改日志:
*[2006-3-6 17:07] Ver. 1.00
开始编写;
完成;
/* */
/*********************************************************************************/
void strmcpy(unsigned char dest[], unsigned char src[], int count) {
int i;
for(i = 0; i < count; i ++)
{
dest[i] = src[i];
}
dest[i] = '\0';
}
/**************************************
Linux init main.c源代码分析
1 /*
2 * linux/init/main.c
3 *
4 * (C) 1991 Linus Torvalds
5 */
6
7 #define __LIBRARY__ // 定义该变量是为了包括定义在unistd.h 中的内嵌汇编代码等信息。
8 #include <unistd.h> // *.h 头文件所在的默认目录是include/,则在代码中就不用明确指明位置。
// 如果不是UNIX 的标准头文件,则需要指明所在的目录,并用双引号括住。
// 标准符号常数与类型文件。定义了各种符号常数和类型,并申明了各种函数。
// 如果定义了__LIBRARY__,则还含系统调用号和内嵌汇编代码syscall0()等。
9 #include <time.h> // 时间类型头文件。其中最主要定义了tm 结构和一些有关时间的函数原形。
10
11 /*
12 * we need this inline - forking from kernel space will result
13 * in NO COPY ON WRITE (!!!), until an execve is executed. This
14 * is no problem,
学生管理系统 c语言源代码
学生管理系统 c语言源代码
#include <stdio.h>
#include <dos.h>
#include <string.h>
#include <stdlib.h>
#include <malloc.h>
#define SIZE 8
struct student
{
char name[20];
char num[15];
int score[5];
float ave;
struct student *next;
}stu[SIZE],temp,s;
void shuru()
{
int i,j,sum,length,flag=1,a;
FILE *fp;
while(flag==1)
{
printf("Define a range>class number:");
scanf("%d",&a);
printf("Input the total number of the class(<a):");
scanf("%d",&length);
if(length<a)
flag=0;
}
for(i=0;i
C语言小游戏源代码《打砖块》
#include "graphics.h"
#include "stdio.h"
#include "conio.h" /*所需的头文件*/
int on; /*声明具有开关作用的全局变量*/
static int score; /*声明静态的记分器变量*/
/* 定义开始界面函数*/
int open()
{
setviewport(100,100,500,380,1); /*设置图形窗口区域*/
setcolor(4); /*设置作图色*/
rectangle(0,0,399,279); /*以矩形填充所设的图形窗口区域*/
setfillstyle(SOLID_FILL,7); /*设置填充方式*/
floodfill(50,50,4); /*设置填充范围*/
setcolor(8);
settextstyle(0,0,9); /*文本字体设置*/
outtextx