当在Linux下频繁存取文件
后,物理内存会很快被用光,当程序
结束后,内存不会被正常释放,而是一直作为caching。这个问题,貌似有不少人在问,不过都没有看到有什么很好解决
的办法。那么我来谈谈这个问题。
一、通常情况
先来说说free命令
:
引用
[root@server ~]# free -m
total used free shared buffers cached
Mem: 249 163 86 0 10 94
-/+ buffers/cache: 58 191
Swap: 511 0 511
其中:
引用
total 内存总数
used 已经使用的内存数
free 空闲的内存数
shared 多个进程共享的内存总额
buffers Buffer Cache和cached Page Cache 磁盘缓存
的大小
-buffers/cache 的内存数:used – buffers – cached
+buffers/cache 的内存数:free + buffers + cached
可用的memory=free memory+buffers+cached
。
有了这个基础
后,可以得知,我现在used为163MB,free为86MB,buffer和cached分别为10MB,94MB。
那么我们来看看,如果我执行复制文件,内存会发生什么变化.
引用
[root@server ~]# cp -r /etc ~/test/
[root@server ~]# free -m
total used free shared buffers cached
Mem: 249 244 4 0 8 174
-/+ buffers/cache: 62 187
Swa ......
------------------------------------------
本文系本站原创,欢迎转载!
转载请注明出处:http://ericxiao.cublog.cn/
------------------------------------------
一:前言
在键盘驱动代码分析的笔记中,接触到了input子系统.键盘驱动,键盘驱动将检测到的所有按键都上报给了input子系统。Input子系统是所有I/O设备驱动的中间层,为上层提供了一个统一的界面。例如,在终端系统中,我们不需要去管有多少个键盘,多少个鼠标。它只要从input子系统中去取对应的事件(按键,鼠标移位等)就可以了。今天就对input子系统做一个详尽的分析.
下面的代码是基于linux kernel 2.6.25.分析的代码主要位于kernel2.6.25/drivers/input下面.
二:使用input子系统的例子
在内核自带的文档Documentation/input/input-programming.txt中。有一个使用input子系统的例子,并附带相应的说明。以此为例分析如下:
#include <linux/input.h>
#include <linux/module.h>
#include <linux/init.h>
#include <asm/irq.h>
#include <asm/io.h>
&n ......
; break;
}
if (type != EV_SYN)
dev->sync = 0;
if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event)
dev->event(dev, type, code, value);
if (disposition & INPUT_PASS_TO_HANDLERS)
input_pass_event (dev, type, code, value);
}
在这里,我们忽略掉具体事件的处理.到最后,如果该事件需要input dev ......
Linux Input Device 介紹: APIs
jollen 發表於 April 8, 2009 12:18 PM
Linux 的 Input Device 是重要的一個 subsystem,在進行實例介紹前,先大略了解一下相關的 API。
Linux Input Device
input.c是Linux的”input”驅動程式,主要支援鍵盤與滑鼠的輸入;input.c介面有趣的地方是採用了事件(event)的方式來處理輸入,以下是input.c介面重要的資料結構與函數:
* struct input_dev
* void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
* void input_register_device(struct input_dev *);
* void input_unregister_device(struct input_dev *);
* void input_register_handler(struct input_handler *);
* void input_unregister_handler(struct input_handler *);
Linux 的input機制可用來實作「虛擬鍵盤」或「虛擬滑鼠」,只要呼叫input_event()將輸入資料發 ......
随着硬件不断的发展,未来的智能手机将越来越接近PC的性能,一个强大的手机操作系统将是挖掘不断飞跃的手机硬件性能的关键,只有强大的操作系统才能支持各种不断发展的手机应用,如Linux系统对java的完美支持以及优越的多进程调度,摩托罗拉很早就推出基于Linux系统的手机,随着Google的Android操作系统的推出,另一个基于Linux的手机操作系统MeeGo也进入研发计划,相信未来的智能手机软件应用将更加丰富多彩。
背景新闻
http://tech.sina.com.cn/t/2010-02-16/14043860000.shtml
诺基亚和英特尔宣布联合创建一个基于Linux的新操作系统MeeGo。MeeGo整合了诺基亚的Maemo和英特尔的Moblin两大Linux计算环境,专为上网本和智能手机等便携设备设计,还可用于车辆和电视上网等非桌面平台。两家公司此次携手令人瞩目,这不仅是因为MeeGo将两大Linux平台整合到一个屋檐下,也是因为该操作系统跨平台支持英特尔和ARM芯片。由于低耗电需求,ARM芯片目前普遍用于苹果iPhone等智能手机中。
MeeGo操作系统意在让应用开发商一次性编写程序,随后就可以用于从智能手机到上网本等一切应用硬件平台;在竞争日益激烈的智能手机领域,这一竞争策略正日益盛行。Adobe近期也采用了同一战略 ......
The Linux USB input subsystem is a single, harmonized way to manage all input devices. This is a relatively new approach for Linux, with the system being partly incorporated in kernel version 2.4 and fully integrated in the 2.5 development series.
This article covers four basic areas: a description of what the input subsystem does, a short historical perspective on development, a description of how the input subsystem is implemented in the kernel and an overview of the user-space API for the input subsystem and how you can use it in your programs. The first three areas are discussed in this article. The user-space API, the final topic, will be discussed in Part II of this article.
What Is the Input Subsystem?
The input subsystem is the part of the Linux kernel that manages the various input devices (such as keyboards, mice, joysticks, tablets and a wide range of other devices) that a user uses to interact with the kernel, command line and graphical user interface. This subsystem i ......