2011-09-13 16:07 用户级别的cpu绑定
绑定线程或进程函数:sched_setaffinity和pthread_setaffinity_np,pthread_setaffinity_np需要NPTL-version的pthread library。
sched_setaffinity example:
#include <stdio.h> #include <math.h> #include <sched.h> double waste_time(long n) { double res = 0; long i = 0; while(i <n * 200000) { i++; |
2011-04-08 13:53 /* This example installs a signal handler routine for SIGFPE, catches an integer overflow condition, makes an adjustment to AX register, and returns. This example program MAY cause your computer to crash, and will produce runtime errors depending on which memory model is used. */ #pragma inline #include <stdio.h> #include <signal.h> #include "assert.h" void Catcher(int sig) { |
2011-04-08 12:18 select函数: 系统提供select函数来实现多路复用输入/输出模型。原型: #include <sys/time.h> #include <unistd.h> int select(int maxfd,fd_set *rdset,fd_set *wrset,fd_set *exset,struct timeval *timeout); 参数maxfd是需要监视的最大的文件描述 |
2011-04-08 9:39
在Linux系统中,Resouce limit指在一个进程的执行过程中,它所能得到的资源的限制,比如进程的core file的最大值,虚拟内存的最大值等。
Resouce limit的大小可以直接影响进程的执行状况。其有两个最重要的概念:soft limit 和 hard limit。
struct rlimit { rlim_t rlim_cur; rlim_t rlim_max; }; soft limit是指内核所能支持的资源上限。比如对于RLIMIT_NOFILE(一个进程能打开的最大文件 数 |
2010-10-11 15:45 守护进程
在linux或者unix操作系统中在系统的引导的时候会开启很多服务,这些服务就叫做守护进程。为了增加灵活性,root可以选择系统开启的模式,这些模式叫做运行级别,每一种运行级别以一定的方式配置系统。 守护进程是脱离于终端并且在后台运行的进程。守护进程脱离于终端是为了避免进程在执行过程中的信息在任何终端上显示并且进程也不会被任何终端所产生的终端信息所打断。
|
2010-09-29 17:06 在学习linux内核代码及一些开源软件的源码(如:DirectFB),经常可以看到有关__attribute__的相关使用。本文结合自己的学习经历,较为详细的介绍了__attribute__相关语法及其使用。
GNU C的一大特色(却不被初学者所知)就是__attribute__机制。__attribute__可以设置函数属性(Function Attribute)、变量属性(Variable Attribute)和类型属性(Type Attribute)。
__attribute__书写特征是:__attribute__前后 |
2008-11-14 12:00 /* 编译通过环境,Windows XP sp2,Windows 2003 server SDK,VC++6.0 sp5. */
/************************************************************************
* File: UDP group broadcast header file
* Author: WenXiaoyong,Wen_kernel@163.com
* Copyright: (C) WenXiaoyong,2007
* |
2008-11-13 13:33
VC中的socket通讯例程(UDP协议)
UDP的服务器端:(UdpSrv.cpp)
#include "Winsock2.h"
#include "stdio.h"
void main()
{
//初始化socket库
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 1, 1 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 )
{
return;
}
if ( LOBYTE( wsaData.wVersion ) != 1 |
2008-09-02 17:03 名称
gdb - GNU 调试器
提要
gdb [-help] [-nx] [-q] [-batch] [-cd=dir] [-f] [-b bps]
[-tty=dev] [-s symfile] [-e prog] [-se prog] [-c
core] [-x cmds] [-d dir] [prog[core|procID]]
描述
|
2008-09-02 11:35 | | |