易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux 编程段错误(segmentation error)总结

   最近一段时间在linux下用C做一些学习和开发,但是由于经验不足,问题多多。而段错误就是让我非常头痛的一个问题。不过,目前写一个一千行左右的代码,也很少出现段错误,或者是即使出现了,也很容易找出来,并且处理掉。
    那什么是段错误?段错误为什么是个麻烦事?以及怎么发现程序中的段错误以及如何避免发生段错误呢?
    一方面为了给自己的学习做个总结,另一方面由于至今没有找到一个比较全面介绍这个虽然是“particular problem”的问题,所以我来做个抛砖引玉吧。下面就从上面的几个问题出发来探讨一下“Segmentation faults"吧。
目录
1。什么是段错误?
2。为什么段错误这么“麻烦”?
3。编程中通常碰到段错误的地方有哪些?
4。如何发现程序中的段错误并处理掉?
正文
1。什么是段错误?
下面是来自Answers.com的定义:
Quote:
A
segmentation fault (often shortened to segfault) is a particular error
condition that can occur during the operation of computer software. In
short, a segmentation fault occurs when a program attempts to access a
memory location that it is not allowed to access, or attempts to access
a memory location in a way that is not allowed (e.g., attempts to write
to a read-only location, or to overwrite part of the operating system).
Systems based on processors like the Motorola 68000 tend to refer to
these events as Address or Bus errors.
Segmentation is one
approach to memory management and protection in the operating system.
It has been superseded by paging for most purposes, but much of the
terminology of segmentation is still used, "segmentation fault" being
an example. Some operating systems still have segmentation at some
logical level although paging is used as the main memory management
policy.
On Unix-like operating systems, a process that accesses
invalid memory receives the SIGSEGV signal. On Microsoft Windows, a
process that accesses invalid memory receives the
STATUS_ACCESS_VIOLATION exception.
另外,这里有个基本上对照的中文解释,来自http://www.linux999.org/html_sql/3


相关文档:

linux常用命令


ps -ef|grep tomcat   查看正在启动的线程
cd .. 退回上一极
ls 列出当前目录的文件
kill -9 [线程号]  关闭线程
su - root 登陆账号
阅读(0)| 评论(14)| 分享(0) 较新一篇:转:带搜索分页的gird 较旧一篇:疯子 评论| 赞
周帅 2010-01-26 18:23
su - root 登陆账号
周帅 2010-01-26 19:53
......

Linux开启SSH

#pacman -S openssh #安装openssh
安装完成后在/etc/rc.conf的最底部DAEMONS后添加sshd让系统启动时自动启动openssh
DAEMONS=(syslog-ng network netfs crond sshd)
也可手动启动openssl,执行
#/etc/inin.d/sshd start
默认情况下其它电脑是不能通过ssh来访问archlinux的,需要修改两个文件来实现:
/etc/h ......

使用PHP做Linux/Unix守护进程

http://linux.chinaitlab.com/administer/774036.html
[  起源 ]Linux/Unix下守护进程(Daemon)大家都知道,比如我们常用的httpd、mysqld等等,就是常驻内存运行的程序,类似于Windows下的服务。一般守护进程都是使用C/C++来写,就是通过fork生成子进程,当前台shell下的父进程被杀掉,子进程就转到后台运行,为了不 ......

linux开机logo制作

1、制作logo的方法:
 首先选择一个自己喜欢的图片,然后通过GIMP软件将该图片保存为.png格式,
 变换方式这个就不说了(very easy),比如保存为linuxlogo.png.
然后将该图片传入到装有Linux PC比如(ubuntu),按照以下顺序你就可以制作一个你喜欢logo
前提你必须安装以下的工具(pngtopnm,pnmquant,pnmtoplainpnm)
$ ......

如何编写linux下nand flash驱动 1


【简介】如何编写linux下nand flash驱动-1
version: 1.0
date:20090721
Author:crifan
Mail:green-waste(At)163.com
【编写驱动之前要了解的知识】
1.       硬件特性:
【Flash的硬件实现机制】
Flash全名叫做Flash Memory,属于非易失性存储设备(Non-volatile Memory Devi ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号